don't know if i'm too tired or maybe too dumb.. however the script wasn't working because i misspelled .portlet-content with .post- content
so sorry guys, i'll try to don't waste more of your time next time. thank you for minimized.push(...). i forgot to put [i] after the variable name. On 7 Set, 18:39, Nate Laws <[email protected]> wrote: > You should get firebug for firefox, and then console.log("stuff") for > debugging instead of using document.writeln. > I think your problem is this line: > minimized=jQuery($this).parents("div").find(".minimizable").attr("id"); > > which should instead be something like: > minimized.push(jQuery($this).closest("div.minimizable").attr("id")); > > since minimized is an array you have to add stuff to it, not > just reassign it. > > It would help with debugging if you did console.log(minimized) inside of the > .each() callback. > > On Mon, Sep 7, 2009 at 11:45 AM, Lotti <[email protected]> wrote: > > > it seems that ":hidden" doesn't work or find items.. > > > if i print the content of the cookie everything i get is blank.. the > > setCookieState() is called after clicking on the box's ui-icon that > > makes the div to "toggle('blind')". > > > so... when a div it "toggled" it get :hidden tag or not? > > > however here it is my code > > > <!-- div structure --> > > > <div id="b1" class="minimizable" > > <h3 class="portlet-header">title</h3> > > <div id="portlet-content"> > > texttexttexttexttexttexttexttexttext > > </div > > </div> > > > <script type="text/javascript"> > > function setCookieState() > > { > > var s=""; > > var i=0; > > var j=0; > > > var minimized=new Array(); > > > jQuery(".post-content").filter(":hidden").each(function(){ > > minimized=jQuery($this).parents("div").find(".minimizable").attr > > ("id"); > > i++; > > }); > > > // make array from current order > > for (i=0; i<minimized.length; i++) > > { > > if (i==minimized.length-1) s+=minimized[i]+"=1"; > > else s+=minimized[i]+"=1,"; > > } > > > // save custom order to cookie > > jQuery.cookie("nextrl_homepage_block_state", s); > > document.writeln(s); //--> nothing will be print!! > > } > > > function addButtons() > > { > > jQuery(".minimizable").find(".portlet-header") > > .addClass("ui-widget-header") > > .append('<span class="ui-icon ui-icon-plus > > ui-switch"></span>') > > .end() > > .find(".portlet-content"); > > > addEvents(); > > } > > > function addEvents() > > { > > jQuery(".portlet-header .ui-switch").click(function() { > > > jQuery(this).toggleClass("ui-icon-minus"); > > > jQuery(this).parents(".minimizable").find > > (".portlet-content").toggle('blind'); > > setCookieState(); > > }); > > } > > > jQuery(function() { addButtons(); }); > > </script> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---
