jQuery Cycle 插件 - 将寻呼机锚点更改为工作日
我想创建一个按天排序的菜单。一切正常,除了寻呼机不会输出工作日。我的代码如下:
var days = new Array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday" );
$('#main')
.before('<div id="nav">')
.cycle({
fx: 'toss',
timeout: 0,
pager: '#nav',
options: {
pagerAnchorBuilder: function(i,el) {
return '<a href="#">'+document.write(days[i+1])+'</a>';
}
}
});
但是,它仍然默认为数字。有人能指出我正确的方向吗?
I want to create a menu that sorts by days. Everything works except the pager won't output weekdays. My code is as follows:
var days = new Array("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday" );
$('#main')
.before('<div id="nav">')
.cycle({
fx: 'toss',
timeout: 0,
pager: '#nav',
options: {
pagerAnchorBuilder: function(i,el) {
return '<a href="#">'+document.write(days[i+1])+'</a>';
}
}
});
It still defaults to numbers, however. Can someone point me in the right direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你有三个错误。首先,不要内联使用
document.write
,其次,您嵌套了一个额外的options
元素。传递给cycle
调用的全部内容就是选项。第三, idx 和您的数组都是零索引,因此不需要+ 1
:You have three errors. First, don't use
document.write
inline, second, you are nesting an extraoptions
element. The whole thing passed to thecycle
call are the options. Third, bothidx
and your array are zero indexed, so no need for the+ 1
: