@cnbritain/merlin-frontend-elementmagnify-js
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -8,11 +8,11 @@ "use strict"; | ||
import { | ||
addClass, | ||
addEvent, | ||
addEventOnce, | ||
removeClass, | ||
removeEvent | ||
addClass, | ||
addEvent, | ||
addEventOnce, | ||
removeClass, | ||
removeEvent | ||
} from '@cnbritain/merlin-frontend-utils-js/js/functions'; | ||
function ElementMagnifyMouse(el, options) { | ||
EventEmitter.call(this); | ||
EventEmitter.call(this); | ||
@@ -33,5 +33,7 @@ this._containerPosition = null; | ||
preloadImage(this.el.getAttribute("data-magnify-url")); | ||
preloadImage(el.getAttribute("data-magnify-url")); | ||
this._init(); | ||
this.event = options.event; | ||
this._init(); | ||
} | ||
@@ -43,9 +45,9 @@ | ||
'_init': function() { | ||
this.resize(); | ||
this.resize(); | ||
}, | ||
'_bind': function() { | ||
this._bindDOM(); | ||
this._bindEvents(); | ||
this._bindStyles(); | ||
this._bindDOM(); | ||
this._bindEvents(); | ||
this._bindStyles(); | ||
}, | ||
@@ -55,3 +57,3 @@ | ||
var magnifierLayer = this._magnifierLayer = document.createElement("div"); | ||
magnifierLayer.className = "g-magnifier__layer g-magnifier__hidden"; | ||
magnifierLayer.className = "g-magnifier__layer g-magnifier--hidden"; | ||
magnifierLayer.setAttribute("title", "Click to close"); | ||
@@ -65,3 +67,3 @@ magnifierLayer.style.backgroundImage = 'url(' + this.el.getAttribute("data-magnify-url") + ')'; | ||
magnifierLayer.style.backgroundImage = 'url(' + url + ')'; | ||
removeClass(magnifierLayer, "g-magnifier__hidden"); | ||
removeClass(magnifierLayer, "g-magnifier--hidden"); | ||
}); | ||
@@ -82,5 +84,5 @@ }, | ||
// Hide the image | ||
addClass(this.el.querySelector(".a-gallery__image__wrapper"), "g-magnifier__hidden"); | ||
addClass(this.el.querySelector(".a-gallery__image__wrapper"), "g-magnifier--hidden"); | ||
// Hide the share buttons | ||
addClass(this.el.querySelector(".a-gallery__aside"), "g-magnifier__hidden"); | ||
addClass(this.el.querySelector(".a-gallery__aside"), "g-magnifier--hidden"); | ||
}, | ||
@@ -132,5 +134,5 @@ | ||
'_unbind': function() { | ||
this._unbindDOM(); | ||
this._unbindEvents(); | ||
this._unbindStyles(); | ||
this._unbindDOM(); | ||
this._unbindEvents(); | ||
this._unbindStyles(); | ||
}, | ||
@@ -140,3 +142,3 @@ | ||
// We remove on the timer so we can transition the fade | ||
addClass(this._magnifierLayer, "g-magnifier__hidden"); | ||
addClass(this._magnifierLayer, "g-magnifier--hidden"); | ||
setTimeout(bind(function() { | ||
@@ -160,5 +162,5 @@ this._magnifierLayer.parentNode.removeChild(this._magnifierLayer); | ||
// Show the image | ||
removeClass(this.el.querySelector(".a-gallery__image__wrapper"), "g-magnifier__hidden"); | ||
removeClass(this.el.querySelector(".a-gallery__image__wrapper"), "g-magnifier--hidden"); | ||
// Show the share buttons | ||
removeClass(this.el.querySelector(".a-gallery__aside"), "g-magnifier__hidden"); | ||
removeClass(this.el.querySelector(".a-gallery__aside"), "g-magnifier--hidden"); | ||
}, | ||
@@ -169,3 +171,3 @@ | ||
this._unbind(); | ||
this._unbind(); | ||
@@ -187,2 +189,4 @@ this.isOpen = false; | ||
this._onLayerMousemove(this.event); | ||
this.isOpen = true; | ||
@@ -189,0 +193,0 @@ this.emit("open"); |
{ | ||
"name": "@cnbritain/merlin-frontend-elementmagnify-js", | ||
"cnOptions": {}, | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "A handy-dandy reusuable front-end component for great justice.", | ||
@@ -6,0 +6,0 @@ "main": "js/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19879
283