从外部页面到特定幻灯片的jquery循环链接? [英] jquery cycle link from external page to specific slide?

查看:75
本文介绍了从外部页面到特定幻灯片的jquery循环链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一直在仔细阅读所有其他问题,我无法弄清楚这一点。我有一个主页,其中包含我使用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>

我已经研究过使用pagerAnchorBuilder添加命名锚点,然后在我的链接中引用该锚点。成功添加命名锚点:

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>

我认为这与updateActivePagerLink有关。有没有办法以某种方式让命名的锚告诉页面循环哪个幻灯片激活?或者还有另一种方法更容易吗?这似乎是一个常见的应用程序!我是jQuery的初学者。无法理解!

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!

推荐答案

您可以通过调整穷人的寻呼机 jQuery Cycle示例。在这个JSFiddle 中,我已经使用了该代码并将其更改为使用链接而不是按钮。

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.

它检查页面加载是否有锚ID,如果找到,则向相关元素发送一个click事件。

It checks on page load for an anchor ID and, if it finds one, send a click event to the relevant element.

    if (location.hash)
    {
        $('#' + location.hash.substring(1)).click();
    }

这篇关于从外部页面到特定幻灯片的jquery循环链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆