Created
March 28, 2012 18:00
-
-
Save benhuson/2228781 to your computer and use it in GitHub Desktop.
TouchCarousel - Detach
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Detach carousel - same as destroy but content is not removed */ | |
detach: function() { | |
this.stopAutoplay(); | |
this._itemsWrapper.unbind(this._downEvent); | |
$(document).unbind(this._moveEvent).unbind(this._upEvent); | |
$(window).unbind(this._resizeEvent); | |
if(this.settings.keyboardNav) { | |
$(document).unbind("keydown.touchcarousel"); | |
} | |
if (this._dragContainer.parent().hasClass('touchcarousel-wrapper')) { | |
this.setXPos(0); | |
this._dragContainer.unwrap(); | |
} | |
}, |
japborst
commented
May 20, 2012
via email
I inserted it in the minified version, because at the moment I do not have
access to the normal one. So that might cause the issue, though in theory I
guess it shouldn't matter.
I am certain the one is active though, so that shouldn't be the problem. No
parameters are needed for the function, right?
…On May 20, 2012 11:07 PM, "Ben Huson" < ***@***.***> wrote:
I added the detach function after the destroy function around line 666 in
jquery.touchcarousel-1.0.js
Seems to work OK for me. Just have to make sure you only call it on an
active version of the carousel?
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/2228781
Where about's in the minified version did you add it?
It won;t work if you just add it at the end I don't think.
You really need the non-minified version to do it
I added it after the 'prev' function was declared. Thus, right after: "{c=(this._jq2-1)_this._hs2}else{c=0}}else{c=d_this._hs2}}this.goTo(c,a)}," (just ctrl+f to find that)
I de-minified mine and I see where the problem lies. After minifying the functions _[something] have all be renamed to shorter ones, therefore e.g. _Itemswrapper does not exist, therefore you cannot unbind it.
I got it working, thanks for everything :) In addition I added the option to remove the pagingNav when present.
Cool, glad it works for you.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment