简体   繁体   English

链接到jQuery工具的特定幻灯片可滚动

[英]Link to specific slide of jQuery-tools scrollable

jQuery tools seems to have support for this built into the Tabs object, but not scrollable. jQuery工具似乎支持Tabs对象内置的此功能,但不能滚动。

I want to be able to link to a specific slide on the following scrollable: http://jsfiddle.net/cutcopypaste/5UWsr/ 我希望能够链接到以下滚动条上的特定幻灯片: http : //jsfiddle.net/cutcopypaste/5UWsr/

I'm using 我正在使用

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

but it doesn't seem to be doing anything. 但它似乎没有任何作用。 It picks up the hashtag fine, but the click event is either not firing or not firing on the correct element. 它可以很好地拾取主题标签,但是click事件未触发或未在正确的元素上触发。

Could you help me with how to mimic a click on an element to navigate to the correct slide? 您能帮我模仿一下单击元素以导航到正确的幻灯片吗? or some other way of getting this to work? 或其他一些使它起作用的方式?

I am worried I'll get weird scrolling down the page to the anchor name, but will worry about that only if it does actually happen. 我担心我会奇怪地向下滚动页面到锚点名称,但仅在确实发生这种情况时才会担心。

Assuming you want to deeplink so that scrollable will scroll to a certain slide based on GET URL? 假设您要进行深层链接,以便可滚动屏幕将基于GET URL滚动到某个幻灯片? here's what I do: 这是我的工作:

scrollapi = $("#scrollableID").data("scrollable");
deeplink = window.location.search.substring(1)
if (deeplink) {
    scrollapi.seekTo(deeplink);
}

Add the GET string is just the number of the slide you want to link to. 添加GET字符串就是您要链接的幻灯片的编号。 (starts at 0) (从0开始)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM