How to open div slowly?

Hi,

I have this code:

<div style="margin:10px 5px 10px;float:right">
 <a href="#" id="chk1" style="text-decoration:underline" title="<?php echo $this->__('Click here to open') ?>"><?php echo $this->__('Click here if you have any Promo Codes') ?></a>
</div>

<div class="discount" id="box1" style="display:none">
stuff here
</div>
<script>
(function(){
	function i(){
		var r=this.id.replace(/\D/g,""),i="box1";
		n[i]=!n[i],t(r,n[i]),localStorage.showing=JSON.stringify(n)}
		function t(n,t){document.getElementById("chk1").checked=t,document.getElementById("box1").style.display=t?"block":"none"}
		var n;n=JSON.parse(localStorage.showing||"null"),n?t(1,n.box1):n={box1:!0},document.getElementById("chk1").onclick=i})();
</script>

…but I have some problems with it. For one it takes two clicks to open. Also, when I click it makes the page scroll back to the top. Those are the two main issues I’m having but it would be nice if it would open on the first click, and not scroll back to the top and it would be really nice to get it to open slowly.

The way it works is that if one opens it it will stay open even if they leave the page and come back or vise versa.

I have jQuery v2.0.0 installed and don’t want to install any more scripts than I have too.

Can someone please help me to get it to work correctly?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.