I am using AngularJS 1.2 and Bootstrap 2.3, although I think it is irrelevant that Angular is involved since this is just jQuery. I want to be able to turn the affix
on and off for a particular element. I have multiple elements on my page using affix
so I can't just disable all instances of the plugin on the page. Also, my problem is unrelated to screen sizes so css is not possible.
For an element for which I have added affix to:
$(element).affix();
Things I have tried that I read about online/stackoverflow to remove the affix, but have been unsuccessful:
$(element).off('.affix');
$(element).removeData('affix').removeClass('affix affix-top affix-bottom');
Is it possible to just remove the affix aspect of this element?
Any help would be great!
m.e.conroy :
In Bootstrap 2.3 you use affix like this:\n\n<div data-spy=\"affix\" data-offset-top=\"200\">...</div>\n\n\nI would think you need to remove the data-spy attribute from an element\n\nel = $(el);\nvar affixed = el.attr('data-spy');\nif((typeof affixed != undefined) && (affixed !== false) && (affixed == 'affix'))\n el.removeAttr( \"data-spy\" );\n\n\nSomething like that I think would work. Of course you could also remove the data-offset... attribute as well if there is one.",
2013-11-18T20:17:24