我正在创建一个脚本,在X分钟后生成一个内容储物柜。问题是,likeButton中的内容不会显示。模态弹出窗口显示正常,标题和说明也是如此。只是不喜欢按钮内容。如果我从计时器中取出代码块,它就可以工作。我有点困惑。有什么想法吗?
var title = 'Please Press Like';
var instructions = 'Like our videos? Join our fanpage. It takes 1 second.';
var lockDelay = 100; // 1200000 = 20 Minutes
/* STOP EDITING */
var boxy;
$(document).ready(function() {
// Create the like button
setTimeout(function() {
// Create the like button
var likeButton = '<div id="likeButton"><fb:like href="" send="false" layout="box_count" width="70" show_faces="false" font=""></fb:like></div>';
// Display the modal
boxy = new Boxy('<p id="instructions">' + instructions + '</p>' + likeButton, {
title: title,
modal: true,
closeable: false,
});
}, lockDelay);
// Close modal after user likes
$('#likeButton').mouseover(function() {
setTimeout(function() {boxy.hide()}, 3000);
});
});
答案 0 :(得分:1)
试试这个
var title = 'Please Press Like';
var instructions = 'Like our videos? Join our fanpage. It takes 1 second.';
var lockDelay = 100; // 1200000 = 20 Minutes
/* STOP EDITING */
var boxy;
$(document).ready(function() {
// Create the like button
setTimeout(function() {
// Create the like button
var likeButton = '<div id="likeButton"><fb:like href="" send="false" layout="box_count" width="70" show_faces="false" font=""></fb:like></div>';
// Display the modal
boxy = new Boxy('<p id="instructions">' + instructions + '</p>' + likeButton, {
title: title,
modal: true,
closeable: false,
});
// Close modal after user likes
$('#likeButton').mouseover(function() {
setTimeout(function() {boxy.hide()}, 3000);
});
}, lockDelay);
});