Skip to content

Commit

Permalink
Force flyout to display when .show() is invoked manually
Browse files Browse the repository at this point in the history
  • Loading branch information
i-like-robots committed Jul 15, 2014
1 parent 855f064 commit 4d11c3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,13 @@ <h1>

<dl>
<dt>
<code>.show(<var>[MouseEvent|TouchEvent]</var>)</code>
<code>.show(<var>[MouseEvent|TouchEvent]</var>, <var>[Boolean]</var>)</code>
</dt>
<dd>
Displays the zoom image flyout. Optionally takes an instance of a
<a href="https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent">mouse</a> or
<a href="https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent">touch event</a>.
<a href="https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent">touch event</a>
and can be set to only display if the mouse is over the target.
</dd>
<dt>
<code>.hide()</code>
Expand Down Expand Up @@ -292,4 +293,4 @@ <h1>
</script>

</body>
</html>
</html>
7 changes: 4 additions & 3 deletions src/easyzoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

if ( ! e.originalEvent.touches || e.originalEvent.touches.length === 1) {
e.preventDefault();
self.show(e);
self.show(e, true);
}
})
.on('mousemove.easyzoom touchmove.easyzoom', function(e) {
Expand All @@ -86,14 +86,15 @@
/**
* Show
* @param {MouseEvent|TouchEvent} e
* @param {Boolean} testMouseOver
*/
EasyZoom.prototype.show = function(e) {
EasyZoom.prototype.show = function(e, testMouseOver) {
var w1, h1, w2, h2;
var self = this;

if (! this.isReady) {
this._load(this.$link.attr('href'), function() {
if (self.isMouseOver) {
if (!testMouseOver || self.isMouseOver) {
self.show(e);
}
});
Expand Down
2 changes: 0 additions & 2 deletions test/spec/easyzoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@
start();
};

api.isMouseOver = true;

api.show();

});
Expand Down

0 comments on commit 4d11c3d

Please sign in to comment.