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

Destroy function tweak and fix #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 12 additions & 9 deletions jquery.jWindowCrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,19 @@
};

base.destroy = function() {
base.$image.removeData("jWindowCrop"); // remove data
$(document).unbind(); // remove body binds
base.$image.unbind(); // remove image binds
base.$frame.unbind(); // remove frame binds
base.$frame.find('.jwc_zoom_out').unbind(); // remove zoom triggers
base.$frame.find('.jwc_zoom_in').unbind(); // remove zoom triggers
$('.jwc_loader').remove(); // remove the added text
$('.jwc_controls').remove(); // remove the added controls
base.$image.removeData("jWindowCrop"); // remove data
$(document).off('mouseup.'+base.namespace); // remove body binds
$(document).off('mousemove.'+base.namespace); // remove body binds
base.$image.off('mousedown.'+base.namespace); // remove image binds
base.$image.off('load.'+base.namespace); // remove image binds
base.$frame.off('mouseleave.'+base.namespace); // remove frame binds
base.$frame.off('mouseenter.'+base.namespace); // remove frame binds
base.$frame.find('.jwc_zoom_out').off('click.'+base.namespace); // remove zoom triggers
base.$frame.find('.jwc_zoom_in').off('click.'+base.namespace); // remove zoom triggers
$('.jwc_loader').remove(); // remove the added text
$('.jwc_controls').remove(); // remove the added controls
base.$image.removeAttr( 'style' ); // undo the style
base.$image.unwrap(); // undo the wrap
base.$image.unwrap(); // undo the wrap
};

base.setZoom = function(percent) {
Expand Down