单击jQuery平滑滚动,使用选项卡跳转页面

单击jQuery平滑滚动,使用选项卡跳转页面,jquery,tabs,smooth-scrolling,Jquery,Tabs,Smooth Scrolling,目前正在使用Easy Smooth Scroll Links插件设计Wordpress网站。我还将SiteOrigin页面生成器与Tabs小部件一起使用。当您单击不同的选项卡时,“选项卡”小部件会更改地址栏中的URL。示例:Example.com/tab1、Example.com/tab2等。我的问题是,当我单击选项卡时,页面会跳转。但是只有当标签在屏幕的中间,而不是在屏幕的顶部或屏幕的底部时才发生。 以下是smooth scroll插件使用的代码: <script

目前正在使用Easy Smooth Scroll Links插件设计Wordpress网站。我还将SiteOrigin页面生成器与Tabs小部件一起使用。当您单击不同的选项卡时,“选项卡”小部件会更改地址栏中的URL。示例:Example.com/tab1、Example.com/tab2等。我的问题是,当我单击选项卡时,页面会跳转。但是只有当标签在屏幕的中间,而不是在屏幕的顶部或屏幕的底部时才发生。 以下是smooth scroll插件使用的代码:

            <script type="text/javascript">
            jQuery.noConflict();
            (function($){

                var jump=function(e)
                {
                   if (e){
                       var target = $(this).attr("href");
                   }else{
                       var target = location.hash;
                   }

                    var scrollToPosition = $(target).offset().top - 90;

                   $('html,body').animate({scrollTop: scrollToPosition },900 ,'easeInSine' );

                }

                $('html, body').hide()

                $(document).ready(function()
                {
                    $("area[href*=\\#],a[href*=\\#]:not([href=\\#]):not([href^='\\#tab']):not([href^='\\#quicktab']):not([href^='\\#pane']):not([href^='#dryer']):not([href^='#pet']):not([href^='#tile']):not([href='#upholstery-cleaning']):not([href='#pet-odor-removal']):not([href='#tile-grout-cleaning'])").bind("click", jump);

                    if (location.hash){
                        setTimeout(function(){
                            $('html, body').scrollTop(0).show()
                            jump();
                        }, 0);
                    }else{
                      $('html, body').show()
                    }
                });

            })(jQuery);
        </script>
<?php  } else {  ?>
        <script type="text/javascript">
            jQuery.noConflict();
            (function( $ ) {
                $(function() {
                    // More code using $ as alias to jQuery
                    $("area[href*=\\#],a[href*=\\#]:not([href=\\#]):not([href^='\\#tab']):not([href^='\\#quicktab']):not([href^='\\#pane'])<?php if($essl_exclude_begin) echo $essl_exclude_begin; ?><?php if($essl_exclude_match) echo $essl_exclude_match; ?>").click(function() {
                        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
                            var target = $(this.hash);
                            target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
                            if (target.length) {
                            $('html,body').animate({
                            scrollTop: target.offset().top - <?php if (get_option('essl_offset')!='') {echo get_option('essl_offset');} else {echo '20';} ?>  
                            },<?php if (get_option('essl_speed')!='') {echo get_option('essl_speed');} else {echo '900';} ?> ,'<?php echo  get_option('essl_easing','easeInQuint');?>');
                            return false;
                            }
                        }
                    });
                });
            })(jQuery); 
        </script>               
            <?php } 
    }                   
}   
endif; 
?>
正如你所看到的,我已经在锚点或散列上添加了一些豁免,我不希望平滑滚动动作发生在锚点或散列上。它在Firefox中运行良好,但由于某些原因在Chrome中不起作用。我已经清除了缓存几次,以确保它不是那样


任何帮助都将不胜感激。谢谢大家!

在Easy Smooth Scroll Links插件中禁用启用从一个页面到另一个页面的滚动设置应该可以解决这个问题。另外,考虑使用不受此问题影响的插件。