I have a web application that doesn't run correctly in chrome. Works perfectly in Firefox. I have a page with a large numbered of list items, 316 to be exact. Each list item contains a large amount of HTML. My problem is when I want to hide or show these list items.
I have a test page on jsFiddle to show the problem I'm having. I stripped down the HTML page to one unordered list to hold all 316 list items. I have two buttons that simply call jQuery hide or show when clicked. Again this runs fast in Firefox, Opera, even IE, pretty well in Safari but in Google Chrome it can take over 30 seconds which brings up the dialog window asking if you want to kill the page because a script is running to long.
Here is the link to jsFiddle
http://jsfiddle.net/oumichaelm/UZCZc/3/embedded/result/
thanks for any input. jmm
The hide() method hides the selected elements. Tip: This is similar to the CSS property display:none. Note: Hidden elements will not be displayed at all (no longer affects the layout of the page). Tip: To show hidden elements, look at the show() method.
What is jQuery Hide Show? With jquery, you can show and hide HTML elements with the hide() and show() methods. hide() method hides the selected HTML element by simply setting the inline style display: none for the selected elements.
The toggle() method toggles between hide() and show() for the selected elements. This method checks the selected elements for visibility. show() is run if an element is hidden. hide() is run if an element is visible - This creates a toggle effect.
The show() Method in jQuery is used to display the hidden and selected elements. Note: This method display the hidden elements which are using CSS display: none property. The elements are not visible whose visibility is hidden.
Looks like this has nothing to do with jQuery and just is a problem with Chrome hiding an parent element that has a HUGE number of children elements.
This just uses basic javascript to hide the element on document ready:
document.getElementById('sortable-lines').style.display="none";
And it still takes forever after the document is ready.
http://jsfiddle.net/petersendidit/UZCZc/10/embedded/result/
Opened a Chrome bug for this: http://code.google.com/p/chromium/issues/detail?id=71305
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With