通过调用其API一个jQuery插件(超大型)的函数作为。点击的一部分 [英] Calling function of a JQUERY Plugin ( supersized ) via its API as part of a .click

查看:133
本文介绍了通过调用其API一个jQuery插件(超大型)的函数作为。点击的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我远在JS精通,所以请原谅任何明显的疏漏。我一直在试图使用超大型背景幻灯片插件的API作为)一个普通(元素)的一部分。点击(函数(

的API文档这里含。部分我的问题看似很重要的:


  

api.goTo(targetSlide)触发器过渡到目标幻灯片编号。


  //转到滑动#$ 5(元素)。点击(函数(){api.goTo(5);});

在此基础上

,我会为了有一个div拍摄以下code类按钮负载幻灯片编号5:

  $(文件)。就绪(函数(){$(按钮)。点击(函数(){
  api.goTo(5);
});
});

这不工作 - 而事实上,插件的名字是不是在code随时随地使得它显然,上述code缺乏的东西。我只是不知道什么。我也尝试将其放置在插件的源和主题内的各个位置 - 但至今没有运气

<一个href=\"http://stackoverflow.com/questions/6904154/how-do-i-use-this-api-of-supersized-jquery-plugin\">This一个相关的帖子我发现。不过,此人有问题是由在不侦听click事件,而是由插件中的一个功能触发的方式修改插件的主题解决。不过,我在这里包括它作为背景资料。

任何帮助将大大AP preciated。


解决方案

我偶然发现了同样的问题 - 然后意识到,我已经下载了超大型版本3.1.3(从遗产的版本的最新这里 ),并完全忽视(下载链接为的电流的版本3.2.4截至今日)。然而,API调用只从3.2上升的支持 - 所以也许你遇到了同样的问题。

下载最新版本后,同样的code您发布工作就好在我结束。

I'm far from proficient in JS, so please forgive any obvious oversights. I've been trying to use the API of the Supersized background slideshow plugin as part of a regular (element).click(function().

The API is documented here incl. the part seemingly important for my problem:

api.goTo( targetSlide ) Triggers transition to target slide number.

//Goes to slide #5    $(element).click(function(){ api.goTo(5); });

Based on this, I would shoot for the following code in order to have a div with class "button" load slide number 5:

$(document).ready(function(){

$(".button").click(function(){
  api.goTo(5);
});
});

This doesn't work - and the fact that the name of the plugin isn't anywhere in the code makes it obvious that the above code is lacking something. I just have no idea what. I also tried placing it in various locations within the plugin's source and themes - but no luck so far.

This is a related post I've found. However, the problem this person had was solved by modifying the plugin's theme in a manner that doesn't listen for the click event but rather is triggered by a function within the plugin. Still, I'm including it here as background info.

Any help would be greatly appreciated.

解决方案

I stumbled upon the same problem - and then realized that I had downloaded SuperSized version 3.1.3 (the latest from the legacy versions here), and totally overlooked the download link for the current version (3.2.4 as of today). However, the API calls are only supported from 3.2 upward - so maybe you are experiencing the same problem?

After downloading the latest version, the very same code you posted worked just fine on my end.

这篇关于通过调用其API一个jQuery插件(超大型)的函数作为。点击的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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