javascript - 如何在 Vegaswalk 背景图库中淡入文本

标签 javascript jquery

您好,我正在使用 vegas 背景脚本,并且想使用“vegaswalk”功能为每个背景添加标题。一切正常,但我想在 div id="marketingText"上添加 fadeIn,这可能吗?文本每次都需要淡入。

  $('body').bind('vegaswalk',
  function(e, bg, step) {
    if(step == 0) {
        $('#marketingText').text("new dialog title 1");
        }
    if(step == 1) {
        $('#marketingText').text("new dialog title some different text 2");
        }
    if(step == 2) {
        $('#marketingText').text("new dialog title more text 3");
        }
    if(step == 3) {
        $('#marketingText').text("new dialog title and some more 4");
        }
  }
);

我尝试过以下方法

$('#marketingText').hide().fadeIn(3000).text("new dialog title 4");

最佳答案

尝试如下:

  var $mark= $('#marketingText');
  var textsArr = [ // Array of texts
    "new dialog title 1",
    "new dialog title some different text 2",
    "new dialog title more text 3",
    "new dialog title and some more 4"
  ];

  $('body').bind('vegaswalk', function(e, bg, step) {
    $mark.hide().text( textsArr[step] ).fadeIn(1000);
  });

关于javascript - 如何在 Vegaswalk 背景图库中淡入文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26665114/

相关文章:

javascript - 在reactjs中使用js数组创建动态元素

javascript - 为什么 JavaScript 接受具有重复属性的对象?

javascript - 如何在使用拆分后获取数组中的第一项

当div有参数隐藏时,jQuery自定义内容滚动条不显示

javascript从数组中删除项目

javascript - 场外特定链接上的退出消息

javascript - 检查复选框是否被选中(js/jquery)

javascript - jQuery 插件中对象没有方法 'charAt'

javascript - 创建自定义头像

javascript - CKEditor:如何禁用键盘快捷键?