开发者

Calling function of a JQUERY Plugin ( supersized ) via its API as part of a .click

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 pr开发者_运维技巧oblem 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜