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

[2.0] Thumbnailer component: container option #260

Open
wants to merge 1 commit into
base: WIP-2.x
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
demos/test*
node_modules
.idea
6 changes: 5 additions & 1 deletion demos/thumbnail.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ <h5>Customize Position and Styling with CSS</h5>

<h3>Additional Features</h3>

<ul><li>Can be locked to an individual Selection object.</li><li>Can be resized using <code>resize(w,h)</code> method.</li></ul>
<ul>
<li>Can be locked to an individual Selection object.</li>
<li>Can be resized using <code>resize(w,h)</code> method.</li>
<li>Can be inserted in selected container by providing element in <code>container</code> option.</li>
</ul>
<div class="tapmodo-footer"><a href="http://tapmodo.com" class="tapmodo-logo segment">tapmodo.com</a>
<div class="segment"><b>&copy; 2008-2013 Tapmodo Interactive LLC</b>
<div>Jcrop is free software released under <a href="../MIT-LICENSE.txt">MIT License</a></div>
Expand Down
4 changes: 3 additions & 1 deletion src/component/Thumbnailer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// If this value is set, the preview will only track that Selection
selection: null,

container: null, // defaults to jCrop container
fading: true,
fadeDelay: 1000,
fadeDuration: 1000,
Expand All @@ -24,6 +25,7 @@
init: function(core,options){
var t = this;
this.core = core;
Thumbnailer.defaults.container = this.core.container;
$.extend(this,Thumbnailer.defaults,options);
t.initEvents();
t.refresh();
Expand Down Expand Up @@ -56,7 +58,7 @@
this.element = $('<div />').addClass('jcrop-thumb')
.width(this.width).height(this.height)
.append(this.preview)
.appendTo(this.core.container);
.appendTo(this.container);
},
resize: function(w,h){
this.width = w;
Expand Down