Refactor
:my
=>
'code'
Codes
Refactorings
Popular
Best
Submit
Spam
Account
Logout
Login
JavaScript doesn't seem to be activated, expect things to be ugly and sloppy!
Learn How to Create Your Own Programming Language
createyourproglang.com
Recent
Working PS3 Jailbreak 3.65 And 3.66
ExtaBit Premium Accounts and Cookies
Steam Wallet Hack - Money Adder & Hack v3
Empires & Allies Hack Cheat Trainer v5.4.1
Eve Onnline 60 Days Time Card Generator v2
Xbox Lve Generator v3
Better way to get content via jQuery $.get()
Free CarTown Blue Points Generator and CarTown Templates
Steam Wallet Hack 2012
Diablo 3 error 37 & error 3006 fix
Popular
XBOX POINTS GENERATOR - MICROSOFT POINTS GENERATOR v1.2012
11 may 2012 premium uploading accounts 100% working
Free Microsoft Points
Free Microsoft Points - Microsoft Points Generator - Xbox Live Codes 2012
Car Town Free Blue Points Hack
Free CarTown Blue Points Generator and CarTown Templates
Free Microsoft Points
Simple Days Purger
Sharecash Downloader Bypass Surveys New 05/2012
PAYPAL REMOVE ACCESS LIMITED ACCOUNT 100% Working
Pastable version of
Simple jQuery script - Optimisation
<pre class='prettyprint' language='javascript'>$(document).ready(function(){ $('#nav_menu_1').before('<a id="open_all" class="" href="#">Screen reader users can click here to open all menus</a>'); $("#menu_column ul li").not("#menu_column ul li ul li").each(function(){ checkCookie(this); }); function checkCookie(li) { var menu_index = $(li).index(); var menu_id = $(li).parent().parent().attr('id'); var cookie_state = $.cookie(menu_id + '_' + menu_index); if(cookie_state === null || cookie_state === '0') { $('ul', li).slideUp('fast'); $("a", li).not("#menu_column ul li ul li a").addClass('closed'); // Add class of closed to top level headings to add rounded corners $("span", li).addClass('closed'); // Add class of closed to top level headings to add rounded corners if ($(li).children('ul').length) { $(li).children('a, span').before('<div class="toggle nav_arrow_light_down"></div>'); } else { $(li).not("#menu_column ul li ul li").addClass('no_toggle'); // If no children add no_toggle class } }; if(cookie_state === '1') { $(li).children('a, span').before('<div class="toggle nav_arrow_light_up"></div>'); }; } $('#menu_column #open_all').click(function(){ // For screen reader users - Opens all menus $('#menu_column .toggle').each(function(){ if($(this).hasClass('nav_arrow_light_down')){ $(this).siblings('ul').slideDown('fast'); $(this).removeClass('nav_arrow_light_down'); $(this).addClass('nav_arrow_light_up'); $(this).next().removeClass("closed"); changeCookie(this) } }); }); function changeCookie(toggle) { if($(toggle).hasClass('nav_arrow_light_down')){ var menu_index = $(toggle).parent().index(); var menu_id = $(toggle).parent().parent().parent().attr('id'); $.cookie(menu_id + '_' + menu_index, '0', { path: '/' }) }else{ var menu_index = $(toggle).parent().index(); var menu_id = $(toggle).parent().parent().parent().attr('id'); $.cookie(menu_id + '_' + menu_index, '1', { path: '/' }); } } $('.toggle').click(function(){ $(this).siblings('ul').slideToggle(300); $(this).next().toggleClass('closed'); $(this).toggleClass('nav_arrow_light_up'); $(this).toggleClass('nav_arrow_light_down'); changeCookie(this); return false }); });</pre> <a href="http://www.refactormycode.com/codes/1364-simple-jquery-script-optimisation" style="color:#fff" title="As seen on RefactorMyCode.com"><img alt="Small_logo" src="http://www.refactormycode.com/images/small_logo.gif" style="border:0" /></a>