user interface – JQuery UI Sortable: Toggle all portlets when created? – Education Career Blog

I am referring to the portlet example here

All the divs of the class ‘portlet-content’ are displayed when the demo starts. I am trying to get them to collapse when the page loads, and I tried this:

$('.portlet-content').toggle();

Inside the document.ready(). However this doesn’t work.

However, if I enter the statement above using the Firebug console, it does work. Do I need to override some default event?

Edit: It seems that the toggle works; however, when the tab is selected, it seems that all the div inside it are also toggled. Is there anyway to prevent this behaviour?

,

Perhaps, you should try with another event:

$(window).load(function()
{
$('.portlet-content').toggle();
});

In the demo js, it must exist something executing after the dom is loaded ($(document).ready)

Leave a Comment