高低を検索しましたが、特定の状況に役立つ投稿は見つかりませんでした。私はjQueryを初めて使用し、その幅広い用途が大好きです。アコーディオンスクリプトに問題があり、ScrollToを追加して、セクションが選択されている場合に、ウィンドウがビューの上にある場合にウィンドウを上にスクロールするようにする必要があります。これが理にかなっていることを願っています。お手伝いありがとう。
<script type="text/javascript">
/* <![CDATA[ */
jQuery().ready(function(){
jQuery('#leftnav-navigation').accordion({
active: false,
header: '.head',
navigation: true,
collapsible: true,
animated: 'easeslide',
autoheight: false,
alwaysOpen: false,
});
var accordions = jQuery('#leftnav-navigation');
jQuery('#switch select').change(function() {
accordions.accordion("activate", this.selectedIndex-1);
});
jQuery('#close').click(function() {
accordions.accordion("activate", -1);
});
jQuery('#switch2').change(function() {
accordions.accordion("activate", this.value);
});
jQuery('#enable').click(function() {
accordions.accordion("enable");
});
jQuery('#disable').click(function() {
accordions.accordion("disable");
});
jQuery('#remove').click(function() {
accordions.accordion("destroy");
wizardButtons.unbind("click");
});
return false;
});
/* ]]> */
</script>
彼の助けをくれたckaufmanに感謝します。これが最終的な動作コードです。これが困っている人に役立つことを願っています。
<script type="text/javascript">
/* <![CDATA[ */
jQuery().ready(function(){
jQuery('#leftnav-navigation').accordion({
active: false,
header: '.head',
navigation: true,
collapsible: true,
animated: 'easeslide',
autoheight: false,
alwaysOpen: false,
});
var accordions = jQuery('#leftnav-navigation');
jQuery('#switch select').change(function() {
accordions.accordion("activate", this.selectedIndex-1);
});
jQuery('#close').click(function() {
accordions.accordion("activate", -1);
});
jQuery('#switch2').change(function() {
accordions.accordion("activate", this.value);
});
jQuery('#enable').click(function() {
accordions.accordion("enable");
});
jQuery('#disable').click(function() {
accordions.accordion("disable");
});
jQuery('#remove').click(function() {
accordions.accordion("destroy");
wizardButtons.unbind("click");
});
jQuery('#leftnav-navigation').click(
function() {
var window_top = $(window).scrollTop();
var div_top = $(this).offset().top;
if (window_top > div_top){
$('html, body').animate({scrollTop:div_top}, 300);
}
});
return false;
});
/* ]]> */
</script>