Skip to content

Commit

Permalink
Now ripple stays if you hold mousedown event and goes away on mouseup
Browse files Browse the repository at this point in the history
  • Loading branch information
hazzo committed Jun 13, 2017
1 parent 65cf7b2 commit 43d84db
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 14 deletions.
4 changes: 2 additions & 2 deletions dist/build.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/build.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-ripple-directive",
"version": "1.0.7",
"version": "1.0.8",
"description": "Vue Material Ripple Effect Directive",
"main": "src/ripple.js",
"repository": {
Expand Down
32 changes: 22 additions & 10 deletions src/ripple.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export default {

// Default values.
const props = {
event: 'click',
event: 'mousedown',
transition: 600
};

Expand Down Expand Up @@ -72,21 +72,33 @@ export default {
rippleContainer.style.borderBottomRightRadius = style.borderBottomRightRadius;

setTimeout(function() {

ripple.style.width = radius * 2 + "px";
ripple.style.height = radius * 2 + "px";
ripple.style.marginLeft = dx - radius + "px";
ripple.style.marginTop = dy - radius + "px";
}, 0);

setTimeout(function() {
ripple.style.backgroundColor = "rgba(0, 0, 0, 0)";
}, 250);

setTimeout(function() {
ripple.remove();
rippleContainer.remove();
}, 650);
if(event.type == 'mousedown') {
el.addEventListener('mouseup', function (event) {
setTimeout(function() {
ripple.style.backgroundColor = "rgba(0, 0, 0, 0)";
}, 250);

setTimeout(function() {
ripple.remove();
rippleContainer.remove();
}, 750);
})
} else {
setTimeout(function() {
ripple.style.backgroundColor = "rgba(0, 0, 0, 0)";
}, 250);

setTimeout(function() {
ripple.remove();
rippleContainer.remove();
}, 650);
}
}
}
}
Expand Down

0 comments on commit 43d84db

Please sign in to comment.