简体   繁体   English

超大,根据幻灯片显示div

[英]Supersized, show a div depending on the slide

EDIT: 编辑:

So, I want to take a different approach to try and clarify what I'm looking for, I've been reading as much as I could these last hours and I feel I have a better grasp of how the system works, but I still don't know how to accomplish my goal. 因此,我想采用一种不同的方法来尝试澄清我要寻找的东西,在最近的几个小时里,我一直在阅读尽可能多的东西,我觉得我对系统的工作方式有了更好的了解,但是我仍然不知道如何实现我的目标。

Reference links: 参考链接:

->SUPERSIZED API ->超级API

So, I have the following script: 因此,我有以下脚本:

<script type="text/javascript">

    $(document.body).ready(function () {

        if (vars.current_slide == 5){**-I want it to display a div if the slider is the number 5-**     

}       

    });

</script>

My questions are these: 我的问题是:

1) What do I add in the - - area to display a div that only shows up when the slider is at the 5th slide? 1)我要在--区域添加什么以显示仅在滑块位于第5张幻灯片时显示的div?

2) Am I doing the rest right or am I missing something? 2)我在做休息吗?还是我缺少什么? I created that code so it could be terribly wrong lol, hopefuly I got something right :P 我创建了该代码,所以它可能是非常错误的大声笑,希望我做对了:P

That's all, hope this clarifies it. 仅此而已,希望可以澄清这一点。

Thank you all for the help! 谢谢大家的帮助! I'm really excited to start creating my own scripts :D 我真的很高兴开始创建自己的脚本:D


Alright, so I've uploaded the site with the code you posted and it still doesn't seem to work, I also tried reducing the code to the conditional and the result only but that didn't work either, mind checking it out? 好吧,所以我已经用您发布的代码上传了该网站,但它似乎仍然无法正常工作,我还尝试将代码简化为有条件的代码和结果代码,但这也不起作用,请您检查一下吗?


Click Here 点击这里

Thanks for giving it a thought! 感谢您的思考!

I assume you can manage to create that div using some HTML and CSS. 我假设您可以使用一些HTML和CSS创建该div。

Now, if I understood right, your question is how you can show certain extra information in that div for certain slides. 现在,如果我理解正确,您的问题是如何在某些div中显示某些幻灯片的某些额外信息。

The method for setting the contents of a div in jQuery is quite easy: 在jQuery中设置div内容的方法非常简单:

$("#id_of_div").html("Any <b>HTML</b> content here");

So if you want to set the content of the div to the value of testfield, use 因此,如果要将div的内容设置为testfield的值,请使用

$("#id_of_div").html(testfield);

edit in response to question edit 根据问题编辑

Unfortunately, Supersized does not provide great triggers - the only option you have is editing your theme files. 不幸的是,Supersized无法提供出色的触发器-您唯一的选择是编辑主题文件。

Your best option is probably to add the following code to the theme.afterAnimation() function; 最好的选择可能是将以下代码添加到theme.afterAnimation()函数; for the default theme this is located near the bottom of slideshow/theme/supersized.shutter.js . 对于默认主题,它位于slideshow/theme/supersized.shutter.js的底部附近。

// current slide is #5
if (vars.current_slide == 5) {
    // Get contents of the 'testfield' field
    var testfield = api.getField(testfield);
    // Set the HTML content of testfielddiv to the value of testfield
    if (testfield != "undefined") {
        $("#testfielddiv").html(testfield);

        // Show testfielddiv (which was hidden for all other slides)
        // The 'fast' argument is for a simple animation; it can be omitted
        // to show without animation, or changed to 'slow' or a number in ms
        $("#testfielddiv").show('fast');
    }
}

else {
    // Hide testfielddiv for any other slide
    $("#testfielddiv").hide('fast');
}

Is simple: 很简单:

  1. Open the file: supersized.shutter.js 打开文件:supersized.shutter.js

  2. Find out the following line: 找出以下行:

     slide_current: '.slidenumber', // Current slide number 
  3. This class ".slidenumber" contain the current number slide. 此类“ .slidenumber”包含当前的数字幻灯片。 Then, you can use it in your page: 然后,您可以在页面中使用它:

     <div class="slidenumber"></div> 

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

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