I have one menu toggle div manu which is slide up and down. For that I used jquery.Cookie plugin but still it's not working.
here is my problem : http://jsfiddle.net/wasimkazi/fauNg/10/
please help me...
$(document).ready(function() {
$(".widget2").hide();
var $widget2 = $(".widget2");
readCookie('widget2') === 'open' ? $widget2.show() : $widget2.hide();
$(".box2").toggle(function() {
$(this).next(".widget2").slideDown(200);
setCookie('widget2', 'open', 1);
}, function() {
$(this).next(".widget2").slideUp(200);
setCookie('widget2', 'close', 1);
});
var $inner = $(".inner");
readCookie('inner') === 'open' ? $inner.show() : $inner.hide();
$(".box").toggle(function() {
$(this).next(".inner").slideDown(200);
setCookie('inner', 'open', 1);
}, function() {
$(this).next(".inner").slideUp(200);
setCookie('inner', 'close', 1);
});
});
function setCookie(name, value, days) {
if (days
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = "; expires=" + date.toGMTString();
}
else var expires = "";
document.cookie = name + "=" + value + expires + "; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
<div class="box2"><h3>Tennis</h3>
</div>
<div class="widget2" style="display: none; "><div class="widget"><div class="box"><h3>Australia</h3></div>
<div class="inner" style="display: none; ">
<ul class="leagues">
<li class="even">Australian Open M.</li>
</ul>
<div class="clear-both"></div>
</div></div>
</div>
<div class="box2"><h3>Basketball</h3>
</div>
<div class="widget2" style="display: block; "><div class="widget"><div class="box"><h3>Australia</h3></div>
<div class="inner" style="display: block; ">
<ul class="leagues">
<li class="even"><a href="#" class="league-145">Australian NBL</a></li>
</ul>
<div class="clear-both"></div>
</div></div>
</div>