div を水平方向にスライドさせる JQuery があります。これらの div には、変更された場合に Web ページをリロードする必要があるオブジェクトがあります。問題は、たとえば、#page3 で div にあるオブジェクトを変更すると、Web ページの読み込み時にデフォルトで選択されているため、リロードすると #page1 で div に戻ります。ユーザーが #page3 div のオブジェクトを変更したときに、ページのリロード後も #page3 div が選択されたままになるようにする方法。
Jクエリ:
jQuery(function ($) {
$('a.panel').click(function () {
var $page = $($(this).attr('href')),
$other = $page.siblings('.active');
if (!$page.hasClass('active')) {
$other.each(function (index, self) {
var $this = $(this);
$this.removeClass('active').animate({
left: $this.width()
}, 500);
});
$page.addClass('active').show().css({
left: -($page.width())
}).animate({
left: 0
}, 500);
}
return false;
});
$('a.panel:nth(0)').click();
});