gpt4 book ai didi

javascript - YUI轮播自定义导航

转载 作者:行者123 更新时间:2023-11-28 09:57:33 25 4
gpt4 key购买 nike

Javascript代码

YAHOO.util.Event.onDOMReady(function (ev) {
var carousel = new YAHOO.widget.Carousel("container", {isCircular: true, numVisible:1});
console.log(carousel.set('navigation', {prev: document.getElementById('prev'), next: document.getElementById('next')}));
carousel.render();
carousel.show();
});

HTML

<div id='container'>
<a href='#' ><span id='prev'> Prev </span></a>
<a href='#' ><span id='next'> Next </span></a>
<ol>
<li><img src='history_base_files/200.jpeg' height="300" width="300" /></li>
<li><img src='history_base_files/280.jpg' height="300" width="300" /></li>
<li><img src='history_base_files/350.jpg' height="300" width="300" /></li>
<li><img src='history_base_files/370.jpg' height="300" width="300" /></li>
</ol>
</div>

控制台在设置轮播的导航属性时输出false。网上找不到任何好的引用。

如何使用 anchor 或跨度等自定义导航创建 yui 轮播?

最佳答案

回答我自己的问题以报告对我有用的解决方案

HTML:

<div id='container'>
<a id='prev' href="#" class="yui-carousel-button yui-carousel-prev" role="button"><span><strong>Prev</strong></span></a>
<a id='next' href="#" class="yui-carousel-button yui-carousel-next" role="button"><span><strong>Next</strong></span></a>
<ol>
<li><a href='#'><img src='history_base_files/200.jpeg' height="300" width="300" /></a></li>
<li><img src='history_base_files/280.jpg' height="300" width="300" /></li>
<li><img src='history_base_files/350.jpg' height="300" width="300" /></li>
<li><img src='history_base_files/370.jpg' height="300" width="300" /></li>
</ol>
</div>

向自定义按钮元素添加类 yui-carousel-button、yui-carousel-prev 和 yui-carousel-next 解决了该问题。

关于javascript - YUI轮播自定义导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9772663/

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