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

发布于 2024-11-27 09:34:54 字数 579 浏览 0 评论 0原文

您好,我正在使用超大插件。我想根据加载的幻灯片更改页面中的内容。在文档中我找到了相应的 api,但不知道如何做到这一点。

以下是文档中的复制粘贴

theme.afterAnimation( )

每次幻灯片转换完成时运行。

触发:每次幻灯片转换后

http://buildinternet.com/project/supersized/docs.html#主题后

如果我想在每次幻灯片更改后提示 alert('slide displayed!'); 会怎么样? 我只是无法理解如何使用 这些 api

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.

Below is a copy-paste from the documentation

theme.afterAnimation( )

Runs each time a slide transition is completed.

trigger : after each slide transition

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

If i want to prompt alert('slide changed!'); after each slide change how would it be?
I just cant understand how these apis' could be used.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

云巢 2024-12-04 09:34:54

我是 Supersized 的创建者,我想来这里帮助你解决这个问题。

在实际下载中,位于此处,您会注意到幻灯片文件夹中有一个主题文件夹,单独的来自 js 和 css 文件夹 - 这是我们将重点关注的区域。

Supersized 运行分为两部分:

  1. 基本文件 (js/supersized.3.2.x & css/supersized.css) 其中包含基本功能,例如过渡、下一张/上一张幻灯片以及所有其他基本组件。

  2. 主题文件(位于主题文件夹中)允许您使用自定义项修改幻灯片,例如您提到的,或者进度条和自定义等每张幻灯片的内容。这些文件是分开的,以防止您每次更新基本文件时都会丢失自定义设置(以前的版本就是这种情况)。

在下载中,我包含了 Shutter 主题,我打算让人们将其用作自己开发的基础。 不必担心触及基本文件 - 它们会自动调用主题文件,这是您所有更改都将存放的位置。

如果您打开theme/supersized.shutter.js,您会注意到主题对象文字中有许多函数 - 这是您可以放入主题函数中描述的位置文档。 请记住,编辑演示 html 页面时,您需要更新该文件的路径以指向该文件,因为默认情况下它指向缩小的 theme/supersized.shutter.min.js< /em>.

如果您向 supersized.shutter.js 的底部滚动,您会注意到您正在寻找的 afterAnimation 函数 - 您可以在此处插入 <代码>警报('幻灯片已更改'); 行。

从那里您可以自由地删除不需要的任何功能并构建您自己的主题。

希望对您有所帮助,非常感谢您使用该插件!

最好的,
萨姆·邓恩

I'm the creator of Supersized and I wanted to pop in here and help you straighten this out.

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.

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.

  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. 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. 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.

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'); 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

長街聽風 2024-12-04 09:34:54

我尝试制作自己的主题,这对我有用:

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

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);
清浅ˋ旧时光 2024-12-04 09:34:54

您可以使用这个脚本:

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

You can use this script:

$('.selector').vTicker('init');
    theme.afterAnimation = function() {
    alert('slide changed!');
};
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文