jquery从外部页面循环链接到特定幻灯片?
仔细研究了所有其他问题,但我无法弄清楚这一点。我有一个主页,其中包含我使用 jquery 循环插件的另一个页面的某些幻灯片。我需要做的是将主页上的链接直接链接到不是组中第一张幻灯片的幻灯片。没什么那么复杂。我的主页上有一个这样的链接:
<a href='portfolio.php'>SEE MORE</a>
我研究过使用 pagerAnchorBuilder 添加命名锚点,然后在链接中引用该锚点。成功添加命名锚点:
pagerAnchorBuilder: function(idx, slide) {
return '<li'+s+'><a href="#" name="portfolio'+(idx+1)+'">'+(idx+1)+'</a></li>';
}
但链接到它们没有任何作用。例如:
<a href='portfolio.php#portfolio3>SEE MORE</a>
我认为这与 updateActivePagerLink 有关。有没有办法以某种方式让命名锚点告诉页面循环哪张幻灯片处于活动状态?或者还有其他更简单的方法吗?看起来这将是一个常见的应用程序!我是 jQuery 的初学者。想不通啊!
Been perusing all the other questions, and I can't figure this out. I have a home page that features certain slides from another page I have using the jquery cycle plugin. What I need to do is have the link on the home page link directly to a slide that isn't the first slide of a group. Nothing that complicated. I have a link like this on my home page:
<a href='portfolio.php'>SEE MORE</a>
I've looked into adding named anchors using the pagerAnchorBuilder and then referencing that anchor in my link. Successfully adds named anchors:
pagerAnchorBuilder: function(idx, slide) {
return '<li'+s+'><a href="#" name="portfolio'+(idx+1)+'">'+(idx+1)+'</a></li>';
}
But linking to them does nothing. Ex:
<a href='portfolio.php#portfolio3>SEE MORE</a>
I'm thinking this is related to updateActivePagerLink. Is there a way to somehow have the named anchor tell the page with cycle which slide to make active? Or is there another approach that is easier? Seems like this would be a common application! I'm a beginner at jQuery. Can't figure it out!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过改编 穷人的寻呼机 jQuery Cycle 示例来实现此目的。在 这个 JSFiddle 中,我获取了该代码并将其更改为使用链接而不是按钮。
它在页面加载时检查锚点 ID,如果找到,则将单击事件发送到相关元素。
You can do this by adapting the poor man's pager jQuery Cycle example. In this JSFiddle, I've taken that code and changed it to use links rather than buttons.
It checks on page load for an anchor ID and, if it finds one, send a click event to the relevant element.