Skip to content

Instantly share code, notes, and snippets.

@benhuson
Created March 28, 2012 18:00
Show Gist options
  • Save benhuson/2228781 to your computer and use it in GitHub Desktop.
Save benhuson/2228781 to your computer and use it in GitHub Desktop.
TouchCarousel - Detach
/* 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
Copy link

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)

@japborst
Copy link

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.

@japborst
Copy link

I got it working, thanks for everything :) In addition I added the option to remove the pagingNav when present.

@benhuson
Copy link
Author

Cool, glad it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment