Toggle effect External page jQuery via require or include PHP

3

I'm creating a menu of users, it gets on a page the part that is embedded in other pages like index and home for example. It takes on the role of a widget that is only shown if there is session (user logged in) however it is shown with jQuery's toggle effect to show and hide.

On the script page the toggle effect usually works bad on the pages that it is displayed via include or require it expands and collapses automatically ie opens and closes. As I can solve this, I already researched the API but without success I have already used "perventDefault ()" also without success. Thanks for any help!

    
asked by anonymous 22.09.2014 / 15:12

1 answer

1

Your description of the problem "it automatically expands and collapses or opens and closes" it gives me an idea that you are loading the same code twice.

From the first it gives order to open and from the second to close. Since this happens without interaction or automatically when the page opens, I assume that is the problem.

Take a look at the rendered code and see if you have the script present more than once. If so, do not load the same script more than once.

    
22.09.2014 / 15:46