Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery .toggle() weird behavior with jQuery UI tabs
    primarykey
    data
    text
    <p>Okay, here's my problem. I have a page where I use toggle to show/hide information about an article with a click on the name. And I have another page that use jQuery UI Tabs to display the same page but with different parameter (to be exact 3 tabs: order by Rate, by Date and by Name).</p> <p>So everything working fine until I start to switch tabs and try to toggle element in this other tabs: - Sometimes everything works normal - Sometimes nothing happend. - Sometimes it toggle several times as if the script was loaded several times.</p> <p>To be more precise here's my code:</p> <p>Page where I display tabs: </p> <pre><code> &lt;link rel="stylesheet" href="/projectsoul/CSS/design/jquery.ui.all.css" /&gt; &lt;link rel="stylesheet" href="/projectsoul/CSS/design/jquery-ui-1.8.21.custom.css" /&gt; &lt;script type="text/javascript" src="/projectsoul/JS/jquery-1.7.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/projectsoul/JS/jquery-1.7.2.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/projectsoul/JS/jquery-ui-1.8.21.custom.min.js"&gt; &lt;/script&gt; ... ... ... &lt;div id="content" class="content" class="ui-tabs"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="articles.php" &gt;&lt;span&gt;By Date&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="articles.php?orderby=rate"&gt;&lt;span&gt;By Rate&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="articles.php?orderby=name"&gt;&lt;span&gt;By Name&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; .... .... .... $( "#content" ).tabs({ ajaxOptions: { error: function( xhr, status, index, anchor ) { $( anchor.hash ).html( "Fail to load content." ); } } }); $( "#content").tabs({ fx: { height: 'toggle', opacity: 'toggle', duration: 'slow' } }); $('#content').tabs({ load: function(event, ui) { $(ui.panel).delegate('.intabs', 'click', function(event) { $(ui.panel).load(this.href); event.preventDefault(); }); } }); </code></pre> <p>And now, here is the page i display in these tabs:</p> <pre><code> &lt;link rel="stylesheet" href="/projectsoul/CSS/design/jquery.ui.all.css" /&gt; &lt;link rel="stylesheet" href="/projectsoul/CSS/design/jquery-ui-1.8.21.custom.css" /&gt; &lt;script type="text/javascript" src="/projectsoul/JS/jquery-1.7.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/projectsoul/JS/jquery-1.7.2.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/projectsoul/JS/jquery-ui-1.8.21.custom.min.js"&gt;&lt;/script&gt; &lt;?php while($articles= $articles_data-&gt;fetch()) {?&gt; &lt;h2&gt;&lt;a class="toggler" id="displayText&lt;?php echo $articles["id"] ?&gt;"&gt;&lt;?php echo nl2br(htmlspecialchars($articles["name"])); ?&gt;&lt;/a&gt;&lt;/h2&gt; ... ... &lt;div class="toggle" id="displayText&lt;?php echo $articles["id"] ?&gt;_content"&gt; // CONTENT &lt;/div&gt; } // END OF WHILE &lt;script&gt; $(document).ready(function() { $('.toggle').hide(); $('.toggler').click( function() { var target = this.id + '_content'; // Use ID-selectors to toggle a single element. $('#' + target).toggle(); // Use class-selectors to toggle groups of elements. $('.' + target).toggle(); $('.toggle.always').toggle(); }); }); &lt;/script&gt; </code></pre> <p>As I said, the toggling work when the second page is displayed alone. But in tabs and after switching it doesn't work anymore.</p> <p>I've searched but didn't find anything that seems to be like that... Any idea ?</p> <p>I hope I made myself clear ^^"</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload