Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/2.3.0 #56

Merged
merged 9 commits into from
Mar 16, 2015
Prev Previous commit
Next Next commit
added onMove callback in options
  • Loading branch information
spescina authored and i-like-robots committed Feb 19, 2015
commit 73d492bc82a149c7515ccffc066ff098b7b9963a
4 changes: 2 additions & 2 deletions dist/easyzoom.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,12 @@ <h1>
<dd>
Callback function to execute when the flyout is removed. Default: <code>undefined</code>
</dd>
<dt>
<var>onMove</var>
</dt>
<dd>
Callback function to execute when the cursor is moved while over the image. Default: <code>undefined</code>
</dd>
</dl>

</section>
Expand Down
16 changes: 13 additions & 3 deletions src/easyzoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
onShow: undefined,

// Callback function to execute when the flyout is removed.
onHide: undefined
onHide: undefined,

// Callback function to execute when the cursor is moved while over the image.
onMove: undefined

};

Expand Down Expand Up @@ -203,10 +206,17 @@
this.hide();
}
else {
var top = xt * -1;
var left = xl * -1;

this.$zoom.css({
top: '' + (xt * -1) + 'px',
left: '' + (xl * -1) + 'px'
top: top,
left: left
});

if (this.opts.onMove) {
this.opts.onMove.call(this, top, left);
}
}

};
Expand Down