jQuery UI Accordion performance
Hi all, I 'm using a jQuery UI Accordion and I'm noting that it has an awfull slow transition. And I only have 5 elements on the Accordion.
I have this HTML
- <div id="msgContainer">
- <h3><a href="./somewhere.php">A Header</a></h3>
- <div><p>Content</p></div>
- </div>
The pairs <h3> and <div> repeats within a foreach loop 5 times
And I have this JS:
- $(document).ready(function(){
- $("#msgContainer").accordion({
- active: false,
- collapsible: true,
- autoHeight: false,
- change: markMessageAsRead
- });
- $.getScript("../../js/common/more.js");
- });
- function markMessageAsRead(event, ui) {
- var elText = ui.newHeader.text();
- var laPosLeido = elText.indexOf("-");
- var laPosRespo = elText.indexOf("[")
- if( laPosLeido != -1 )
- var elNewText = elText.substring(0, laPosLeido);
- else
- var elNewText = elText;
- elNewText += " - Leido";
- if ( laPosRespo != -1 )
- elNewText += " [Respondido]";
- ui.newHeader.children("a").text(elNewText);
- ui.newHeader.children("a").css({"font-style":"italic", "color":"#3399CC"});
- if (ui.newHeader.children("a").attr("href") !== undefined)
- if (ui.newHeader.children("a").attr("href").indexOf("f") == -1) {
- $.ajax({
- type: "GET",
- url: ui.newHeader.children("a").attr("href"),
- global: false,
- success: function(res) { alert(res); },
- error: function(xhr, status) { alert(status + ": " + xhr.responseText); }
- });
- var href = ui.newHeader.children("a").attr("href");
- href += "&f=1";
- ui.newHeader.children("a").attr("href", href);
- }
- }
The manipulation of the href and stuff is required, but for the issue I'm telling [I guess] it doesn't matter.
Which is that the Accordion is incredibly slow and clumsy; anybody knows why or have any clues ??
jQuery version: 1.4.2
jQuery UI version: 1.8.1
The app is inside an intranet, if someone requires a live demo to test, I maybe could put a sample of that part only ...
Thank to all