I have the following script which slides in/slide out a DIV from the right:
// jQuery 1.9 > Toggle Event dep 1.8
$(\'#slideClick\').click(function () {
va
In asp.net code
make variable called ex. requestNumber and store it in session
assign a value to +1 in every request
Div "slideClick" add class with requestNumber ex slideClick.Attributes["class","request_"+requestNumber]
In css
slideClick{display:hidden;} slideClick.request_1{display:block;}
UPDATE 1
you may also use
Request.UrlReferrer
if visitor come from website not yours or null, then assign class to appear
after click in any link inside website, UrlReferrer will be your website, then not assign class to appear.
Finally
add class to div you want to appear/disappear according to value get from UrlReferrer, cookie or session as explained above
UPDATE 2
If you insist on your scope, try this
var it = sessionStorage.getItem('it') || 1;
if(it > 1) {
$('#slideClick').parent().animate({ right: '-290px' }, { queue: false, duration: 0 });
$("#imgArrow").attr("src", "../theImages/arrow_expand.png");
}
//var it = $('#slideClick').data('it') || 1;
alert(it);
// jQuery 1.9 > Toggle Event dep 1.8
$('#slideClick').click(function () {
alert(it);
switch (it) {
case 1:
$(this).parent().animate({ right: '-290px' }, { queue: false, duration: 500 });
$("#imgArrow").attr("src", "../theImages/arrow_expand.png");
break;
case 2:
$(this).parent().animate({ right: '-0px' }, { queue: false, duration: 500 });
$("#imgArrow").attr("src", "../theImages/arrow_collapse.png");
break;
}
it++;
if (it > 2) it = 1;
sessionStorage.setItem('it', it);
});
The idea here is to check for the value onload not to wait to click.
Regards