fix for #18 , credits to @waylaidwanderer

This commit is contained in:
FezVrasta 2014-10-02 09:36:03 +02:00
parent 7b5e43fc7b
commit 5b249397d5
2 changed files with 8 additions and 6 deletions

View File

@ -71,7 +71,6 @@ var ripples = {
}; };
var rippleOut = function($ripple) { var rippleOut = function($ripple) {
console.log($ripple);
// Clear previous animation // Clear previous animation
$ripple.className = "ripple ripple-on ripple-out"; $ripple.className = "ripple ripple-on ripple-out";
@ -109,12 +108,14 @@ var ripples = {
// init RippleJS and start ripple effect on mousedown // init RippleJS and start ripple effect on mousedown
bind("mouseover", withRipple, rippleInit); bind("mouseover", withRipple, rippleInit);
console.log(withRipple);
// start ripple effect on mousedown // start ripple effect on mousedown
bind("mousedown", ".ripple-wrapper", rippleStart); bind("mousedown", ".ripple-wrapper", rippleStart);
// if animation ends and user is not holding mouse then destroy the ripple // if animation ends and user is not holding mouse then destroy the ripple
bind("rippleEnd", ".ripple-wrapper .ripple", function(e, $ripple) { bind("rippleEnd", ".ripple-wrapper .ripple", function(e, $ripple) {
if (!mouseDown) {
var $ripples = $ripple.parentNode.getElementsByClassName("ripple");
if (!mouseDown || ( $ripples[0] == $ripple && $ripples.length > 1)) {
rippleOut($ripple); rippleOut($ripple);
} }
}); });

View File

@ -71,7 +71,6 @@ var ripples = {
}; };
var rippleOut = function($ripple) { var rippleOut = function($ripple) {
console.log($ripple);
// Clear previous animation // Clear previous animation
$ripple.className = "ripple ripple-on ripple-out"; $ripple.className = "ripple ripple-on ripple-out";
@ -109,12 +108,14 @@ var ripples = {
// init RippleJS and start ripple effect on mousedown // init RippleJS and start ripple effect on mousedown
bind("mouseover", withRipple, rippleInit); bind("mouseover", withRipple, rippleInit);
console.log(withRipple);
// start ripple effect on mousedown // start ripple effect on mousedown
bind("mousedown", ".ripple-wrapper", rippleStart); bind("mousedown", ".ripple-wrapper", rippleStart);
// if animation ends and user is not holding mouse then destroy the ripple // if animation ends and user is not holding mouse then destroy the ripple
bind("rippleEnd", ".ripple-wrapper .ripple", function(e, $ripple) { bind("rippleEnd", ".ripple-wrapper .ripple", function(e, $ripple) {
if (!mouseDown) {
var $ripples = $ripple.parentNode.getElementsByClassName("ripple");
if (!mouseDown || ( $ripples[0] == $ripple && $ripples.length > 1)) {
rippleOut($ripple); rippleOut($ripple);
} }
}); });