better ripple effect
This commit is contained in:
parent
48b6db0d9a
commit
4e72efcde0
4 changed files with 17 additions and 12 deletions
|
|
@ -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')
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue