loop0007 Posted October 21, 2015 Share Posted October 21, 2015 well i am not a javascript expert or coder i need help to update this javascript so that it works properly with no errors <script type="text/javascript"> <!-- $('.categoryNodeInfo').prepend("<div class='showhideNodes hideNodes'>Collapse</div>"); var showhideNodesCookie = $.getCookie('showhideNodes'); var showhideNodesArray=new Array(); if (showhideNodesCookie) { showhideNodesArray = showhideNodesCookie.split(","); $.each(showhideNodesArray,function(){ var selector = 'li[id='+this+']'; $(selector+' ol.nodeList').hide(); $(selector+' .showhideNodes').toggleClass('showNodes'); $(selector+' .showhideNodes').toggleClass('hideNodes'); $(selector+' .showhideNodes').text('showhideNodes_expand'); }); } $('.showhideNodes').click( function() { if ($(this).text() == 'Collapse') { $(this).parent().next().slideUp(); $(this).text('showhideNodes_expand'); //if($.inArray(this,showhideNodesArray) != -1){ showhideNodesArray.push($(this).parent().parent().attr('id')); $.setCookie('showhideNodes',showhideNodesArray.join(",")); //} } else if ($(this).text() == 'showhideNodes_expand') { $(this).parent().next().slideDown(); $(this).text('Collapse'); var remove = $(this).parent().parent().attr('id'); showhideNodesArray.splice($.inArray(remove,showhideNodesArray),1); $.setCookie('showhideNodes',showhideNodesArray.join(",")); } $(this).toggleClass('showNodes'); $(this).toggleClass('hideNodes'); }); //--> </script> well i hope someone can update it with its same functioning thanks and sorry for my bad english Quote Link to comment https://forums.phpfreaks.com/topic/298736-javiscript-help/ Share on other sites More sharing options...
Ch0cu3r Posted October 21, 2015 Share Posted October 21, 2015 It is no good just dumping the code. How are supposed to help if do not explain what it is you are trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/298736-javiscript-help/#findComment-1523884 Share on other sites More sharing options...
loop0007 Posted October 22, 2015 Author Share Posted October 22, 2015 (edited) It is no good just dumping the code. How are supposed to help if do not explain what it is you are trying to do? my mistake i am sorry ! sorry i didnt't explaind much this code let node/categories of xenforo to collapse and expand but on reload of page they didn't remain collapsed. its collapse and expand function is working but cookie function is not working so i need help for this code to work i can make a live setup if anyone is interested in testing, For Reference : https://xenforo.com/community/threads/dont-work-after-reload-script-js.77211/ Edited October 22, 2015 by loop0007 Quote Link to comment https://forums.phpfreaks.com/topic/298736-javiscript-help/#findComment-1523988 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.