How Do I Stop Jquery Tourbus From Creating Two Instances On Click?
I'm using jQuery Tourbus to guide a user through my website. I want it to show up on loading the window the first time someone visits but after that it shouldn't load unless the us
Solution 1:
I see it this way:
The line $(selector).tourbus()
is to initialize the plugin and bind some functionality to the element selector
. When you put it inside the click
event handler, you are initializing the element only when you click. So, if you click twice, then you are initializing twice. I can only assume clicking three times would initialize the plugin three times on the element; and so forth. When you initialize again, the previous instance(s) still remain attached the element.
So, by putting the line outside the click
event handler, you are ensuring that the plugin is initialized only once.
Post a Comment for "How Do I Stop Jquery Tourbus From Creating Two Instances On Click?"