drtiwd06558 2016-02-18 11:24 采纳率: 100%
浏览 75
已采纳

如何让这个jQuery脚本在WordPress上运行?

This is a slideshow directly added to a page in WordPress. I've added the stylesheet, the script, the slideshow itself and the script which executes the slider function but I just cannot get it in motion.

This is the code of the page:

        //PHP functions
        wp_enqueue_style('slideshow', get_stylesheet_directory_uri() . '/css/slideshow.css', false, '1.1', 'all');
        wp_enqueue_script('jquery.cslider', get_stylesheet_directory_uri() . '/js/jquery.cslider.js', array ('jquery'), 1.1, true);

        <div id="da-slider" class="da-slider">
            <div class="da-slide">
                <h2>1. Easy management</h2>
                <p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean.</p>
                <a href="#" class="da-link">Read more</a>

                <div class="da-info"></div>
                <div class="da-img da-bg1"></div>
            </div>

            <div class="da-slide">
                <h2>2. Revolution</h2>
                <p>A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.</p>
                <a href="#" class="da-link">Read more</a>

                <div class="da-info"></div>
                <div class="da-img da-bg2"></div>
            </div>

            <div class="da-slide">
                <h2>3. Warm welcome</h2>
                <p>When she reached the first hills of the Italic Mountains, she had a last view back on the skyline of her hometown Bookmarksgrove, the headline of Alphabet Village and the subline of her own road, the Line Lane.</p>
                <a href="#" class="da-link">Read more</a>

                <div class="da-info"></div>
                <div class="da-img da-bg3"></div>
            </div>

            <div class="da-slide">
                <h2>4. Quality Control</h2>
                <p>Even the all-powerful Pointing has no control about the blind texts it is an almost unorthographic life One day however a small line of blind text by the name of Lorem Ipsum decided to leave for the far World of Grammar.</p>
                <a href="#" class="da-link">Read more</a>

                <div class="da-info"></div>
                <div class="da-img da-bg4"></div>
            </div>

            <nav class="da-arrows">
                <span class="da-arrows-prev"></span>
                <span class="da-arrows-next"></span>
            </nav>
        </div>

        <script type="text/javascript">
            jQuery(function() {
                jQuery('#da-slider').cslider({
                    autoplay    : true,
                    bgincrement : 450
                });
            });
        </script>

And here is the cslider's link

  • 写回答

2条回答 默认 最新

  • dtwknzk3764 2016-02-21 14:43
    关注

    You must load Modernizer library before cslider because slider uses Modernizer internally. Maybe the best way is to pass Modernizer as dependency when include cslider with wp_enqueue_script() function.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 ubuntu系统下挂载磁盘上执行./提示权限不够
  • ¥15 Arcgis相交分析无法绘制一个或多个图形
  • ¥15 seatunnel-web使用SQL组件时候后台报错,无法找到表格
  • ¥15 fpga自动售货机数码管(相关搜索:数字时钟)
  • ¥15 用前端向数据库插入数据,通过debug发现数据能走到后端,但是放行之后就会提示错误
  • ¥30 3天&7天&&15天&销量如何统计同一行
  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?