1

我对 Django 比较陌生,我正在开发一个使用 JQuery 的网页。我试图让标题使用切换功能来显示更多信息,但是当我加载页面时,<h3>标签会添加一个 style="display: none" 并且标题会消失。我已将静态文件夹和所有必要的文件添加到该文件夹​​中,并检查了我的 settings.py 以确保在 STATIC_URL 和 STATICFILES_DIR 中正确输入了所有内容。

我在网页中的 jquery 代码:

<script type="text/javascript" src="{{ STATIC_URL }}jquery-1.10.1.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}bootstrap/js/bootstrap.js"></script>

<script>
    $(document).ready(function(){

        $('.swarmdetails').hide();

            $('.span4 h3').toggle(
            function(){
                $(this).next('.swarmdetails').fadeIn(0);
                $(this).addClass('close');

            },//end of fadeIn
            function(){
                $(this).next('.swarmdetails').fadeOut(0);
                $(this).removeClass('close');
            }//end of fadeOut
        );//end of toggle

            $('.span4 li').mouseover(function(){
                $(this).popover('show');
            }).mouseout(function(){
                $(this).popover('hide');
            });

            $('.dropdown-toggle').dropdown();
    });

</script>

我试图切换的 HTML:

<div class="span9">
     <div class="row-fluid">
         <div class="span4">
             <h3 style="cursor: help">Resource Utilization</h3>
             <p class="swarmdetails">Here you can view every resource under your management.
                Filters include Project Name, Employee Name, etc </p>
         </div>

         <div class="span4">
             <h3 style="cursor: help">Direct Reports</h3>
             <p class="swarmdetails">Here you can view all managers
             and filter by name. You can use this option to quickly change an resource's
                        manager and also see who each manager has reporting to them.</p>

         </div>
     </div>
 </div>

有人可以帮我弄清楚我做错了什么,以便我可以正常工作吗?

4

1 回答 1

1

认为您正在使用 jQuery >= 1.8,其方法签名.toggle(handler, handler)已被弃用(而不是从 1.9 版中删除)。

可以吗?

于 2013-07-01T22:48:21.017 回答