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

Adjust destroy method and allow images that aren't draggable #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
5 changes: 5 additions & 0 deletions jquery.drag-n-crop.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
max-height: none;
}

.dragncrop-nodrag {
width: 100%;
height: 100%;
}

.dragncrop-containment {
position: absolute;
}
Expand Down
10 changes: 9 additions & 1 deletion jquery.drag-n-crop.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
containment: 'dragncrop-containment',
horizontal: 'dragncrop-horizontal',
vertical: 'dragncrop-vertical',
nodrag: 'dragncrop-nodrag',

// Options' classes
overflow: 'dragncrop-overflow',
Expand Down Expand Up @@ -100,6 +101,9 @@
if (self.options.loaded) {
self.options.loaded();
}
} else {
self._setPosition({top: 0, left: 0});
self.options.loaded();
}
} );

Expand All @@ -110,8 +114,12 @@
this.container.find('.' + this.classes.containment + ',' +
'.' + this.classes.overlay + ',' +
'.' + this.classes.instruction).remove();
this.container.removeClass(this.classes.overflow).removeClass(this.classes.container);
this.element.removeClass(this.classes.horizontal)
.removeClass(this.classes.nodrag)
.removeClass(this.classes.vertical);
this.element.css('left', '');
this.element.css('top', '');
},

getPosition: function() {
Expand Down Expand Up @@ -159,7 +167,7 @@
return true;

}else{

$(this.element).addClass(this.classes.nodrag);
return false;

}
Expand Down