为什么我的jQuery手风琴会停止工作?

时间:2014-05-19 20:10:27

标签: jquery accordion jquery-ui-accordion

我的手风琴不起作用。它工作正常,但最近停止了。我检查了一下,确保我在google的jQuery UI中获取了正确的js文件。你能看出我做错了吗?

http://www.writtenhandshake.com/servicesa.html

javascript代码为:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="/files/theme/jquery.easing.1.3.js"></script>
<script type="text/javascript" src="/files/theme/AccordionVA-jquery.mousewheel.js"></script>
<script type="text/javascript" src="/files/theme/AccordionVA-jquery.vaccordion.js"></script>
<script type="text/javascript">
        $(function() {
            $('#va-accordion').vaccordion();
        });
</script>

HTML代码是:

<div id="va-accordion" class="va-container">
  <div class="va-nav">
      <span class="va-nav-prev">Previous</span>
      <span class="va-nav-next">Next</span>
</div>
<div class="va-wrapper">
    <div class="va-slice va-slice-1">
        <h3 class="va-title">Contracts</h3>
        <div class="va-content">
            <p><span style="color:white; background:rgb(0,0,0); background: rgba(0, 0, 0, 0.2); padding: 4px;">As our most popular service, we have negotiated a wide range of contracts, including: book deals, employment agreements, property management agreements, landlord/tenant leases, and more.</span></p>
            <ul>
                <li><a href="http://www.writtenhandshake.com/portfolio.html">Portfolio</a></li>
                <li><a href="http://www.writtenhandshake.com/contact.html">Contact</a></li>
            </ul>
        </div>
    </div>
    <div class="va-slice va-slice-2">
                    <h3 class="va-title">Business Services</h3>
                    <div class="va-content">
                        <p><span style="color:white; background:rgb(0,0,0); background: rgba(0, 0, 0, 0.7); padding: 4px;">We are passionate about helping young businesses get off the ground. We have helped with all stages of business development, from protecting business proposals, to incorporating new companies, to drafting company policies.</span></p>
                        <ul>
                            <li><a href="http://www.writtenhandshake.com/portfolio.html">Portfolio</a></li>
                            <li><a href="http://www.writtenhandshake.com/contact.html">Contact</a></li>
                        </ul>
                    </div>  
                </div>
                    <div class="va-slice va-slice-3">
                    <h3 class="va-title">Demand Letters</h3>
                    <div class="va-content">
                        <p><span style="color:white; background:rgb(0,0,0); background: rgba(0, 0, 0, 0.2); padding: 4px;">Have one of our attorneys write a demand letter on your behalf.  Often receiving a letter from an attorney is it all it takes to show you are serious.</span></p>
                        <ul>
                            <li><a href="http://www.writtenhandshake.com/portfolio.html">Portfolio</a></li>
                            <li><a href="http://www.writtenhandshake.com/contact.html">Contact</a></li>
                        </ul>
                    </div>  
                </div>
                                    <div class="va-slice va-slice-4">
                    <h3 class="va-title">Wills</h3>
                    <div class="va-content">
                        <p><span style="color:white; background:rgb(0,0,0); background: rgba(0, 0, 0, 0.2); padding: 4px;">We can draft your will for you at an affordable price.</span></p>
                        <ul>
                            <li><a href="http://www.writtenhandshake.com/portfolio.html">Portfolio</a></li>
                            <li><a href="http://www.writtenhandshake.com/contact.html">Contact</a></li>
                        </ul>
                    </div>  
                </div>
                <div class="va-slice va-slice-5">
                    <h3 class="va-title">Attorney Packages</h3>
                    <div class="va-content">
                        <p><span style="color:white; background:rgb(0,0,0); background: rgba(0, 0, 0, 0.7); padding: 4px;">We understand that every case is unique and we are happy to provide more extensive solutions.  Our "Attorney Package" gives you access to an attorney every step of the way, including attorney-drafted documents with step-by-step attorney guidance.</span></p>
                        <ul>
                            <li><a href="http://www.writtenhandshake.com/portfolio.html">Portfolio</a></li>
                            <li><a href="http://www.writtenhandshake.com/contact.html">Contact</a></li>
                        </ul>
                    </div>  
                </div>



</div>
</div>

手风琴工作时的js文件没有任何变化。非常感谢你的帮助!

2 个答案:

答案 0 :(得分:3)

变化:

$(function() {
    $('#va-accordion').vaccordion();
});

要:

jQuery(document).ready(function($) {
    $('#va-accordion').vaccordion();
});

问题是由于你包含了两次jQuery。查看页面来源,您将在第13行包含v1.11.1,在第78行包含v1.7.2。您需要删除其中一个版本或使用我上面的解决方案。

答案 1 :(得分:0)

有些东西正在劫持jQuery名称空间。试试这个:

jQuery(function($) {
    $('#va-accordion').vaccordion();
});