私は、スライド内で/ outパネルのために取り組んでいるスクリプトを持っています。私はjQuery Cookieを組み込んでいます。私はそれをローカルでテストするときにうまく動作しますが、パネルを読み込んだり再読み込みしたり、パネルを読み込んだりしてすぐにシャットダウンすると、ページロード時にクッキーをシャットダウンすることができます。 FiddlejQuery - サイドパネルがクッキーを使用してページの読み込みを行う
$(function() {
if ($.cookie('myCookieName')) {
$('#slideClick').click();
}
});
$('#slideClick').click(function() {
var it = $(this).data('it') || 1;
switch (it) {
case 1:
$(this).parent().animate({ right: '-345px' }, { queue: false, duration: 500 });
$(".slideClose").addClass('hideBtn');
$(".slideOpen").removeClass('hideBtn');
break;
case 2:
$(this).parent().animate({ right: '-0px' }, { queue: false, duration: 500 });
$(".slideOpen").addClass('hideBtn');
$(".slideClose").removeClass('hideBtn');
break;
}
it++;
if (it > 2) it = 1;
$(this).data('it', it);
$.cookie('myCookieName', '1')
});
おかげ
残念ながらもう1つの問題があります。ページ/フレームをリロードすると、タブを2回クリックしてバックアップを開くと、アイデアが表示されます。私は自分のフィドルを更新しました – webmonkey237
あなたはたぶんその変数を閉じた値に設定する必要があります。 – Nick
スイッチケースを逆にするだけで交換できますhttps://jsfiddle.net/sgxu69es/11/ – denchu