【问题标题】:Go to TOP and Search button don't respond转到顶部和搜索按钮不响应
【发布时间】:2018-05-18 05:19:56
【问题描述】:

我的网站上有一个问题,我已经调试了好几天了,但不知何故我卡在哪里寻找解决方案。在my website 上,向下滚动超过折叠时,应该会出现一个“向上箭头”按钮,但它没有。如果您单击放大镜,导航栏下方的部分应向下移动,并且必须出现搜索栏,但事实并非如此。

这些功能依赖于两个 jQuery 脚本:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>

对于上述效果,使用了宏伟的js:

<script  src="{static_url}/tpl-buddy-011/js/jquery.magnific-popup.min.js"></script>

初始化放在一个初始化脚本中

/*
         * Search 
        ---------------------------------------------------- */
        $('.search-trigger').click(function(e) {
            e.preventDefault();
            $('html, body').scrollTop(0);
            $('section.mobile-navigation').hide();
            $('.mobile-nav-trigger').removeClass('active');
            $('body').toggleClass('show-search');
            $('.search-input input[type="text"]').focus();
        });
/* 
         * Menu for Mobile
        ---------------------------------------------------- */ 
        $('.mobile-nav-trigger').click(function(e) {
            e.preventDefault();
            $('body').removeClass('show-search');
            $(this).toggleClass('active');
            $('section.mobile-navigation').slideToggle('fast');
        });

        $(".totoplink a").click(function(e) {
            e.preventDefault();
            $('html, body').animate({
                scrollTop: $("#top").offset().top -88
            }, 800);
        });

搜索栏的 html 代码中的 sn-p 和“转到顶部”:

{* Main navigation *}
            <nav class="pull-right">
              {Navigator loadprops='0' template='buddy011-navigation' number_of_levels='3'}
            </nav>
            <div class="search-wrapper">
              <a href="#" class="search-trigger">{svg use="search"}</a>
            </div>
          </div>
        </div>
      </div>
    </header>


    <div class="wrapper">
    {* mobile navigation *}
      <section class="mobile-navigation">
        {Navigator loadprops='0' template='buddy011-navigation-mobile'  number_of_levels="3"}
      </section>

      {* Search *}
        <section class="search-input">
          {Search search_method="post" formtemplate='buddy011-searchform' resultpage="{if isset($search_page)}{$search_page}{/if}"}
        </section>

我可以放 css,但是这会退出很多代码,这不会使帖子更清晰。我的问题是如何调试网站以找到按钮的缺失行为?

谢谢!

【问题讨论】:

  • 你为什么要使用这样陈旧过时的 jQuery 版本?

标签: javascript jquery html magnific-popup


【解决方案1】:

因为 Mukesh 给出的答案才找到它。注意到与 FlexSlider 相关的错误(不再存在),但该错误导致了该错误。

【讨论】:

    【解决方案2】:

    曾经遇到过相同类型的问题,经过长时间的调查后发现,加载 js-files 的顺序发生了变化。

    【讨论】:

      猜你喜欢
      • 2021-12-29
      • 2017-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多