使用jquery在滑块上设置一些文本动画

时间:2014-04-04 19:09:00

标签: javascript jquery wordpress

您好我正在使用wordil的soliloquy滑块插件,我试图让它为每张幻灯片上的一些文字设置动画。这是我写的小jquery函数,似乎应该可以工作。

    jQuery(document).ready(function($){
    // var $ulist = document.getElementById("soliloquy-325")
    var $allElements =  $("#soliloquy-325").find("li");
    if($allElements.hasClass("soliloquy-active-slide")){
    $this.find("soliloquy-caption").html("<div class='caption'><p>hello</p>            </div>").fadeIn("slow");
    }
    });

但它似乎没有做任何事情,当我检查我的控制台时,我没有收到任何错误。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:2)

我在jsfiddle中放了一些东西 - http://jsfiddle.net/donlaur/SA3La/ 它做了一点动画,并不多。如果你想做不同的事情,你可以改变效果甚至使用.animate。

jQuery(document).ready(function ($) {
// var ulist = document.getElementById("soliloquy-325")
var allElements = $("#soliloquy-325").find("li");
if (allElements.hasClass("soliloquy-active-slide")) {
    $(".soliloquy-caption").html("<div class='caption'><p>hello</p></div>");
    // You set the new hello to a class of caption now
    $(".caption").fadeOut("1000").fadeIn("1500");
}
});