How to increase clickable area surrounding a Vuetify v-slider's nob? - vue.js

How do you increase the clickable area surrounding the nobs of Vuetify's v-slider component?
I would like to do this in order to make it easier for users to 'grab the nob' and control the slider, particularly for the sake of mobile UX.

Here is a method to increase the clickable area of the draggable v-slider and v-range-slider nobs using CSS. It should be noted that, as of February 2021, v-slider and v-range-slider do not yet have built-in props to control this functionality.
My answer is based on this github comment (note: it is worth reading this entire github issue thread, as it concerns the OP's question).
<style scoped lang="scss">
.my-slider-class >>> .v-slider__thumb:after {
transition: 0.3s cubic-bezier(0.25, 0.8, 0.5, 1);
content: '';
color: inherit;
width: 400%;
height: 400%;
border-radius: 50%;
background: transparent;
position: absolute;
left: -150%;
top: -150%;
}
.my-slider-class >>> .v-slider__thumb:before {
transition: 0.3s cubic-bezier(0.25, 0.8, 0.5, 1);
content: '';
color: inherit;
width: 200%;
height: 200%;
border-radius: 50%;
background: currentColor;
opacity: 0.3;
position: absolute;
left: -50%;
top: -50%;
transform: scale(0.1);
pointer-events: none;
}
</style>

Related

Rendering error safari tilt.js over fixed element

There is a view (only on Safari) error when tilt object is over a fixed element.
https://codepen.io/imagica/pen/zYPYbbJ
.header{
height: 100px;
width: 100vw;
background: red;
position: fixed;
}
any ideas how to fix this?
Marco

How can my splash screen be implemented into Vue?

Side note:
The splash screen code below from my Vue app is a view file not a component. Also I'm suing Vue router.
So below is my code, this is a splash screen using Gsap that has a callback function that I can later put in a route that goes to '/' which is the Home view.
How can I have this view showed first when launching the Vue app? And then once the animation is completed the callback will direct the user to the home page. Also one more thing, I'm not sure how this would work, but I want to make sure that once a user goes to the home page and some reason they refresh they don't have to see the splash screen again. How can that also be achieved?
Note: I did try to mess with the index.js under router but nothing worked and redirect never allowed the user to get to the home page.
HTML:
<template>
<div class="module_wrapper">
<h1 ref="title">Welcome</h1>
<div ref="module" class="module">
<div class="top_wrapper">
<div ref="box1" class="box box_1"></div>
</div>
<div class="bottom_wrapper">
<div ref="box2" class="box box_2"></div>
<div ref="box3" class="box box_4"></div>
<div ref="box4" class="box box_5"></div>
<div ref="box5" class="box box_3"></div>
</div>
</div>
</div>
</template>
JavaScript:
import { TimelineLite, Back } from 'gsap';
export default {
methods: {
onCompleteAll () {
console.log('done');
}
},
mounted () {
const {module} = this.$refs;
const {title} = this.$refs;
const {box1} = this.$refs;
const {box2} = this.$refs;
const {box3} = this.$refs;
const {box4} = this.$refs;
const {box5} = this.$refs;
const {top} = this.$refs;
const {bottom} = this.$refs;
const timeline = new TimelineLite({onComplete: this.onCompleteAll});
timeline.to(module, 1.3, {scale: 1, ease: 'elastic.out(1, 0.5)',})
.to(box1, 0.5, {opacity: 1, translateY: 0, ease: Back.easeInOut}, '-=0.4')
.to(box2, 0.5, {opacity: 1, translateY: 0, ease: Back.easeInOut}, '-=0.4')
.to(box3, 0.5, {opacity: 1, translateY: 0, ease: Back.easeInOut}, '-=0.4')
.to(box4, 0.5, {opacity: 1, translateY: 0, ease: Back.easeInOut}, '-=0.4')
.to(box5, 0.5, {opacity: 1, translateY: 0, ease: Back.easeInOut}, '-=0.4')
.to(top, 0.4, {marginLeft: 10 + '%', ease: Back.easeInOut}, '-=0.2')
.to(bottom, 0.4, {marginLeft: 10 + '%', ease: Back.easeInOut}, '-=0.2')
.to(title, 0.4, {
translateY: 0,
opacity: 1,
ease: Back.easeInOut
}, '-=0.8');
}
};
CSS:
#app {
font-family: Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
html {
font-size: 100%;
box-sizing: border-box;
}
*, *::before, *::after {
box-sizing: inherit;
outline: none;
}
html {
width: 100%;
height: 100%;
overflow: hidden;
}
html, body {
transform: perspective(1px) scale(1) translateZ(0);
backface-visibility: hidden;
-webkit-font-smoothing: subpixel-antialiased;
}
body {
background: radial-gradient(#656565, #000000);
width: 100%;
height: 100%;
}
.module_wrapper {
color: white;
text-align: center;
height: 13.4375rem;
width: 18.75rem;
margin: 0;
padding: 0;
border-radius: 0.75rem;
}
h1 {
font-size: 1.4375rem;
font-weight: 500;
color: #D9D9D9;
letter-spacing: 0.5rem;
cursor: default;
opacity: 0;
transform: translateY(10px);
}
.module {
background-color: #fff;
border-radius: 0.75rem;
width: 18.75rem;
height: 11.375rem;
margin: 0;
padding: 0;
transform: scale(0);
}
.top_wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 50%;
padding: 0 1.25rem;
}
.bottom_wrapper {
display: flex;
align-items: center;
padding: 0 1.25rem;
justify-content: space-evenly;
height: 50%;
}
.box {
background-color: #D9D9D9;
border-radius: 0.4375rem;
margin: 0;
padding: 0;
transform: translateY(-40px);
opacity: 0;
}
.box_1 {
width: 14.375rem;
height: 3.6rem;
}
.box_2, .box_3, .box_4, .box_5 {
width: 2.875rem;
height: 3.25rem;
}
You will need to add a Navigation Guard to your / route.
The general idea is:
-Check if the user has already authenticated
-if they have, call next()
-if they haven't, redirect them to the login/splash page: next('login')
There are a few options, but I think the best one will be to control the component's visibility in App.vue rather than inside the component. When the animation is over emit something to the parent, listen to that thing in the parent, and change the component visibility.
In order to display animation only one time, use session storage or local storage, and as the first job on page load, check if storage has anything about that. If it doesn't play your animation.

Resizing Materialize chip component

How to resize the Materialize chip component?
http://materializecss.com/chips.html
I tried changing the CSS of chip, but the round shape distorts.
You can just change it's width and height with css.
.chip{
width: 240px;
height: 80px;
border-radius: 80px;
line-height: 80px;
}
.chip img{
height: 80px;
width: 80px;
}
Standard border-radius is 16px so change this value to the same value as the height this will make the chip round again.
Also the line-height is to make the text centered again.
If you use an image inside the chip you will have to make that bigger aswell.
Example

Set Leaflet map to height: 100% of container

Please how can we set the map div to be height: 100% of its container?
I have tried this within a bootstrap template content section, but all I get is height of 0px. Even Google-Dev tools shows #map height as 0px.
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
}
Set
#map{
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
and give its container position: relative.
The above answer didn't work for me, but this did:
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
width: 100%;
}
..from A full screen leaflet.js map
Leaflet needs an absolute height, and height: 100% only refers to the height of the parent element - if this isn't set, it will default to 0.
If your map is the only element in the body, use height: 100vh to match the height of the viewport (Example).
If your map is inside a container, set height: 100vh on the container (or other desired height) and height: 100% on the map element (Example).

Invisible scrollbars on a position:absolute div on Safari 5 for Windows

I have a single div element in a page styled as follow:
div {position: absolute; width: 340px; height: 480px; overflow-y:scroll}
I use a simple jquery script to center it in the available width and height on window.resize event.
The div is displayed and works perfectly on Safari 5 for Mac.
On Safari 5 for Windows it works perfectly (i can scroll the content using the mouse wheel) but the vertical scrollbar is not rendered.
Any idea?
Thanks in advance.
There's no need to use jquery to center, just use the following:
div {
position: absolute;
width: 340px;
height: 480px;
overflow-y: scroll;
top: 50%;
left: 50%;
margin-top: -240px;
margin-left: -170px;
}
Maybe the scrollbar is not rendered because it's disabled (there's no more content), otherwise try with overflow-y:auto