gpt4 book ai didi

javascript - 我怎样才能让这个 jQuery 脚本在 WordPress 上运行?

转载 作者:行者123 更新时间:2023-12-03 07:39:10 25 4
gpt4 key购买 nike

这是直接添加到 WordPress 页面的幻灯片。我已经添加了样式表、脚本、幻灯片本身以及执行 slider 功能的脚本,但我就是无法让它启动。

这是页面的代码:

        //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>

这是cslider's link

最佳答案

您必须在 cslider 之前加载 Modernizer 库,因为 slider 在内部使用 Modernizer。也许最好的方法是在使用 wp_enqueue_script() 函数包含 cslider 时将 Modernizer 作为依赖项传递。

关于javascript - 我怎样才能让这个 jQuery 脚本在 WordPress 上运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35480095/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com