better ripple effect

This commit is contained in:
jean-emmanuel 2015-11-04 15:51:18 +01:00
parent 48b6db0d9a
commit 4e72efcde0
4 changed files with 17 additions and 12 deletions

File diff suppressed because one or more lines are too long

View file

@ -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();
});
}

View file

@ -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')
}

View file

@ -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;
}
}
}
}