better ripple effect
This commit is contained in:
parent
48b6db0d9a
commit
4e72efcde0
4 changed files with 17 additions and 12 deletions
File diff suppressed because one or more lines are too long
|
|
@ -269,3 +269,11 @@ function isSame(a1, a2){
|
|||
return a1==a2
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$.fn.ripple = function() {
|
||||
$(this).removeClass('ripple').addClass('ripple').delay(250).queue(function(next){
|
||||
$(this).removeClass('ripple');
|
||||
next();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ createWidget.toggle = function(widgetData) {
|
|||
var on = widgetData.on,
|
||||
off= widgetData.off
|
||||
if (v==on) {
|
||||
widget.addClass('on')
|
||||
widget.addClass('on').ripple()
|
||||
if (send) widget.sendValue(v)
|
||||
} else if (v==off) {
|
||||
widget.removeClass('on')
|
||||
|
|
@ -245,11 +245,7 @@ createWidget.push = function(widgetData) {
|
|||
var on = widgetData.on,
|
||||
off= widgetData.off
|
||||
if (v==on) {
|
||||
widget.addClass('on')
|
||||
widget.removeClass('ripple')
|
||||
setTimeout(function(){
|
||||
widget.addClass('ripple')
|
||||
},1)
|
||||
widget.addClass('on').ripple()
|
||||
if (send) widget.sendValue(v)
|
||||
} else if (v==off) {
|
||||
widget.removeClass('on')
|
||||
|
|
@ -303,7 +299,7 @@ createWidget.switch = function(widgetData) {
|
|||
var e = widget.find('.value[data-value="'+v+'"]')
|
||||
if (e.length) {
|
||||
widget.find('.on').removeClass('on')
|
||||
e.addClass('on')
|
||||
e.addClass('on').ripple()
|
||||
if (send) widget.sendValue(v)
|
||||
if (sync) widget.trigger('sync')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -810,8 +810,9 @@ a {
|
|||
}
|
||||
&.on .light {
|
||||
background: $color-accent;
|
||||
}
|
||||
&.ripple .light {
|
||||
animation: ripple .25s linear;
|
||||
animation-fill-mode:backwards;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -895,11 +896,11 @@ a {
|
|||
background: $color-border;
|
||||
border-radius: 8rem;
|
||||
}
|
||||
&.on {
|
||||
&:after {
|
||||
&.on:after {
|
||||
background: $color-accent;
|
||||
}
|
||||
&.ripple:after {
|
||||
animation:ripple 0.25s linear;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue