Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

7 changes: 6 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ <h2>
<tr>
<td><var>errorDuration</var></td>
<td><code>2500</code></td>
<td>The time (in milliseconds) to display the error notice</td>
<td>The time (in milliseconds) to display the error notice.</td>
</tr>
<tr>
<td><var>preventClicks</var></td>
Expand All @@ -265,6 +265,11 @@ <h2>
<td><code>$.noop</code></td>
<td>Callback function to execute when the flyout is removed.</td>
</tr>
<tr>
<td><var>showDelay</var></td>
<td><code>0</code></td>
<td>The amount of time (in milliseconds) that should pass between mouseenter and displaying the zoom image.</td>
</tr>
</tbody>
</table>

Expand Down
37 changes: 24 additions & 13 deletions src/easyzoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
onHide: $.noop,

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

// The amount of time (in milliseconds) that should pass between mouseenter and displaying the zoom image
showDelay: 0

};

Expand Down Expand Up @@ -81,25 +84,33 @@
});
}

this.$target.append(this.$flyout);
var appendFunction = $.proxy(function () {
this.$target.append(this.$flyout);

w1 = this.$target.width();
h1 = this.$target.height();

w1 = this.$target.width();
h1 = this.$target.height();
w2 = this.$flyout.width();
h2 = this.$flyout.height();

w2 = this.$flyout.width();
h2 = this.$flyout.height();
dw = this.$zoom.width() - w2;
dh = this.$zoom.height() - h2;

dw = this.$zoom.width() - w2;
dh = this.$zoom.height() - h2;
rw = dw / w1;
rh = dh / h1;

rw = dw / w1;
rh = dh / h1;
this.isOpen = true;

this.isOpen = true;
this.opts.onShow.call(this);

this.opts.onShow.call(this);
e && this._move(e);
}, this);

e && this._move(e);
if (this.opts.showDelay) {
window.setTimeout(appendFunction, this.opts.showDelay);
} else {
appendFunction();
}
};

/**
Expand Down