I am implementing Headroom.js in one of my websites. Due to usability reasons I need to be able to toggle between initializing and destroying the script when the user clicks on a specific div. This div's id is #hamburger
This is my code so far.
$(document).ready(function(){
$("#hamburger").click(function(){
$(".banner").headroom("destroy");
});
});
Right now, when the user clicks, the Headroom script is destroyed.
However, how can I make the script to initialize if the user clicks the same div again?
I know it's done using:
$(".banner").headroom("init");
but I don't know how to construct this using jQuery.
Any help is appreciated.
Thanks!