Merge pull request #331 from grvcoelho/patch-2

Fix ripples.js to allow multiple elements using ripples
This commit is contained in:
Fez Vrasta 2014-12-29 13:43:33 +01:00
commit c03c4ddf56

View File

@ -67,14 +67,14 @@
/** /**
* Find the ripple wrapper * Find the ripple wrapper
*/ */
var $wrapper = $element.find(".ripple-wrapper"); var $wrapper = $element.children(".ripple-wrapper");
/** /**
* Get relY and relX positions * Get relY and relX positions
*/ */
var relY = self.getRelY(event); var relY = self.getRelY($wrapper, event);
var relX = self.getRelX(event); var relX = self.getRelX($wrapper, event);
/** /**
@ -88,7 +88,7 @@
/** /**
* Get the ripple color * Get the ripple color
*/ */
var rippleColor = self.getRippleColor(); var rippleColor = self.getRipplesColor();
/** /**
@ -159,9 +159,8 @@
/** /**
* Get the relX * Get the relX
*/ */
Ripples.prototype.getRelX = function(event) { Ripples.prototype.getRelX = function($wrapper, event) {
var $element = this.element; var wrapperOffset = $wrapper.offset();
var wrapperOffset = $element.find(".ripple-wrapper").offset();
if(!self.isTouch()) { if(!self.isTouch()) {
/** /**
@ -187,9 +186,8 @@
/** /**
* Get the relY * Get the relY
*/ */
Ripples.prototype.getRelY = function(event) { Ripples.prototype.getRelY = function($wrapper, event) {
var $element = this.element; var wrapperOffset = $wrapper.offset();
var wrapperOffset = $element.find(".ripple-wrapper").offset();
if(!self.isTouch()) { if(!self.isTouch()) {
/** /**
@ -215,7 +213,7 @@
/** /**
* Get the ripple color * Get the ripple color
*/ */
Ripples.prototype.getRippleColor = function() { Ripples.prototype.getRipplesColor = function() {
var $element = this.element; var $element = this.element;
var color = $element.data("ripple-color") ? $element.data("ripple-color") : window.getComputedStyle($element[0]).color; var color = $element.data("ripple-color") ? $element.data("ripple-color") : window.getComputedStyle($element[0]).color;