lukesnowden / FSVS

Full Screen Vertical Scroll
https://www.lukesnowden.co.uk/full-screen-vertical-scroll/
723 stars 145 forks source link

Ability to Programatically Remove FSVS from DOM #14

Closed joncursi closed 9 years ago

joncursi commented 9 years ago

Is it possible to remove FSVS and it's associated events from the DOM programmatically? For example, in a client-side templating system like Ember or Meteor, views are being swapped on and off of the screen without having to refresh the browser. So when I swap out my FSVS view for a non-FSVS view, I'd like to remove these events. Currently, I'm getting some wonky behavior trying to scroll on the non-FSVS views because the events are still present. Thanks!

lukesnowden commented 9 years ago

I understand, I'll add in a "bind" and "unbind" method to allow this.

lukesnowden commented 9 years ago

Give this a whirl let me know if it was what you were looking for.

slider.unbind();
slider.rebind();
joncursi commented 9 years ago

@lukesnowden awesome, this unbinds the events like I was hoping for. I notice that the body element still has class="active-slide-x" attached to it, and the ul id="fsvs-pagination" is still floating around in the DOM, but I can take those out programmatically using jQuery. Thanks!

$('html').attr('class', '');
$('body').attr('class', '');
$('#fsvs-pagination').remove();
lukesnowden commented 9 years ago

I agree it's not the most elegant solution and the code needs refactoring but I'm limited on the time I can spend on it. Thought the event bindings were the most important things to remove

lukesnowden commented 9 years ago

hopefully this will remove most of the lingering aftermath :+1:

joncursi commented 9 years ago

:+1: