如何更改 everythingslider 中的主题标签名称?
我正在使用 Anysslider,如果您熟悉它,您可能会知道它具有以下功能:
hashTags : true, // Should links change the hashtag in the URL?
您可以使用它为每张幻灯片生成唯一的 URL,就像它们是页面一样。但缺点是它会为主题标签生成通用名称。 (例如
http://www.mysite.com/#&panel1-2
我的问题是,如何将这些主题标签的名称更改为每张幻灯片的自定义名称?
现在我正在使用下面的函数使它在导航栏中显示每个幻灯片标题:
navigationFormatter : function(i, panel){
return panel.find('h6').text();
}
我所做的就是在
元素中添加标题那么,我如何也使用这些标题。重命名主题标签?
I am using anythingslider and if you are familiar with it, you might then know that it has the following function:
hashTags : true, // Should links change the hashtag in the URL?
Which you can use to make it generate unique URLs for each slide as if they were pages. But the downside is that it generates generic names for the hashtag. (e.g.
http://www.mysite.com/#&panel1-2
My question is, how can you change the names of those hashtags to custom names for each slide?
Right now I am using the following function to make it display each slide title in the navigation bar:
navigationFormatter : function(i, panel){
return panel.find('h6').text();
}
And all I do is that I add the title in a <h6>
element. So, how could I use these titles to also rename the hashtags?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以关闭默认哈希并使用
onSlideComplete
回调来更新窗口哈希 (演示;和全屏demo):*注意:h6 也有一个 id(不允许空格)与 h6 的文本(允许空格,并在导航选项卡中使用)
HTML
脚本
这里是 另一个演示,使用面板 ID 而不是 h6 ID。
You can turn off the default hash and use the
onSlideComplete
callback to update the window hash (demo; and full screen demo):*note: the h6 also has an id (no spaces allowed) vs the text of the h6 (spaces allowed, and used in the navigation tabs)
HTML
Script
And here's another demo using the panel ID's instead of the h6 ID's.
我从未使用过任何滑块,但如果您想更改它的主题标签,您可以开始在脚本中查找
window.location.hash
来开始,因为哈希生成部分将从那里开始。I've never used anythingslider but if you want to change it's hashtags, you could start looking for
window.location.hash
in the script to begin as the hash generating part would start there.