Search code examples
javascriptjquerybreakpointssticky

Unbinding, Destroying, or Removing previously declared jQuery functions


I'm using two scripts (FixTo and Breakpoints) to allow for "sticky" elements on the page. The problem occurs when I resize the window. I need to destroy the FixTo functionality. Has anyone had any success with this:

$(window).bind('enterBreakpoint1024',function() {
  $('#log').text('debug: Entering 1024 breakpoint');
 // Sticky Elements (scroll)
 $('#stats').fixTo('.container');
 $('#extra').fixTo('.container', {mind: '#stats'});
 $('#right').fixTo('.container');
});

$(window).bind('exitBreakpoint1024',function() {
  $('#log').text('debug: Exiting 1024 breakpoint');
  // Need to Unbind, Destroy, or Remove the fixTo() function
});

Solution

  • I am the author of the plugin.

    I added destroy, stop and start methods to the plugin. Now it is possible to stop functionality temporarily or permanently.

    Fixto will not need breakpoint to work unless you are chasing a custom effect.