简体   繁体   English

我如何使用这个超大jquery插件的api

[英]How do i use this api of supersized jquery plugin

Hi am using supersized plugin. 您好我正在使用超大插件。 I want to change the content in the page depending on what slide is loaded. 我想根据加载的幻灯片更改页面中的内容。 In the documentation i found the api for that, but couldn't figure out how to do it. 在文档中,我找到了api,但无法弄清楚如何做到这一点。

Below is a copy-paste from the documentation 以下是文档中的复制粘贴

theme.afterAnimation( ) theme.afterAnimation()

Runs each time a slide transition is completed. 每次完成幻灯片转换时运行。

trigger : after each slide transition

http://buildinternet.com/project/supersized/docs.html#theme-after http://buildinternet.com/project/supersized/docs.html#theme-after

If i want to prompt alert('slide changed!'); 如果我想提示alert('slide changed!'); after each slide change how would it be? 每次幻灯片改变后会怎么样? I just cant understand how these apis' could be used. 我只是无法理解如何使用这些api'

I'm the creator of Supersized and I wanted to pop in here and help you straighten this out. 我是Supersized的创造者,我想在这里弹出并帮助你理顺它。

In the actual download, located here , you'll notice that within the slideshow folder there is a theme folder, separate from the js and css folders - this is the area we'll focus on. 在实际下载中, 位于此处 ,您会注意到幻灯片文件夹中有一个主题文件夹,与js和css文件夹分开 - 这是我们将关注的区域。

Supersized runs in two parts: 超大型运行分为两部分:

  1. The base files (js/supersized.3.2.x & css/supersized.css) which contain the base functionality such as transitions, next/prev slide, and all the other essential components. 基本文件 (js / supersized.3.2.x和css / supersized.css) ,包含基本功能,如transition,next / prev slide和所有其他基本组件。

  2. The theme files (located in the theme folder) which allow you to modify the slideshow with customizations, like the one you mentioned, or things like progress bars and custom content for each slide. 主题文件 (位于主题文件夹中) ,允许您修改带有自定义的幻灯片,例如您提到的幻灯片,或每张幻灯片的进度条和自定义内容。 These are separated to prevent you from losing the customizations every time there is an update to the base files, which was the case in previous versions. 这些是分开的,以防止您在每次更新基本文件时丢失自定义项,这在以前的版本中就是这种情况。

In the download, I have included the Shutter theme, which I intended for people to use as a foundation for their own development. 在下载中,我已经包含了Shutter主题,我打算让人们将其作为自己开发的基础。 Don't worry about touching the base files - they automatically call the theme files, which is where all of your changes will go. 不要担心触摸基本文件 - 它们会自动调用主题文件,这是您所有更改的所在。

If you open up theme/supersized.shutter.js , you'll notice there are are number of functions within the theme object literal - this is the place where you would drop in the theme functions described in the documentation. 如果你打开theme / supersized.shutter.js ,你会发现主题对象文字中有许多函数 - 这是你放入文档中描述的主题函数的地方。 Keep in mind that you will need to update the path on the demo html page to point to this file once you edit it, since by default it points to the minified theme/supersized.shutter.min.js . 请记住,一旦编辑,您将需要更新演示html页面上的路径以指向此文件,因为默认情况下它指向缩小的主题/ supersized.shutter.min.js

If you scroll towards the bottom of supersized.shutter.js , you'll notice the afterAnimation function you're looking for - this is where you can plug in the alert('Slide Changed'); 如果你滚动到supersized.shutter.js的底部,你会注意到你正在寻找的afterAnimation函数 - 这是你可以插入alert('Slide Changed'); line. 线。

From there you're free to strip out whatever functions you don't need and build out your very own theme. 从那里你可以自由地删除你不需要的任何功能,并构建你自己的主题。

Hope that helps and a big thank you for using the plugin! 希望对使用插件有所帮助并非常感谢!

Best, Sam Dunn 最好的,Sam Dunn

I tried to make my own theme and this worked for me: 我尝试制作自己的主题,这对我有用:

(function($){
    theme = {
        _init : function(){
            console.log('hi im supersized');                
        },
        afterAnimation:function(){
                console.log('Slide Changed');
        }
    };
})(jQuery);

You can use this script: 您可以使用此脚本:

$('.selector').vTicker('init');
    theme.afterAnimation = function() {
    alert('slide changed!');
};

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

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