您好,我正在使用 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/