douhan1992 2012-11-26 17:20 采纳率: 100%
浏览 49

<?php wp_head(); ?>打破页面上的所有jquery滑块

Here is the test server I am working on:

http://www.astwood.co.uk/testsite/wordpress/

I have set up two sliders using liquidSlider (a responsive fork of coda slider) in two of the three red boxes. That break when I put the

<?php wp_head(); ?>

hook in the

<head>

tag.

Can anyone take a look and see if they can shine some light on why?

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • dongni3854 2012-11-26 22:39
    关注

    You've got two instances of the jQuery script on the page! This can create a lot of conflicts and confusion. Either you or one of your plugins is linking to jQuery without using the proper wp_enqueue_script function.

    I'm gonna go ahead and point the finger at Advanced Ajax Page Loader. Try deactivating that plugin and see if your sliders start working. I've looked into it, and that plugin actually does a decent job of enqueueing the script:

    function enqueue_AAPL() {
        //Make sure we use latest jquery?
        wp_deregister_script('jquery');
        wp_register_script('jquery', plugins_url( 'jquery.js' , __FILE__ ));
        wp_enqueue_script('jquery');
    }
    

    So my guess is that you've included <script type="text/javascript" src="http://www.astwood.co.uk/testsite/wordpress/wp-content/themes/AstwoodV3/js/jquery-1.8.2.min.js"></script> somewhere in your header file. Find it, take it out. Then make sure you're enqueueing all your scripts (like jQueryUI, fancybox, liquid-slider, jquery.tweet, etc.) keeping in mind the dependencies parameter

    评论

报告相同问题?