Missing Element Confusion
I'm creating a script that produces a content locker after X number of minutes. The problem is, the content within likeButton will not display. The modal popup displays fine, as does the title 开发者_JAVA百科and instructions. Just not the likeButton content. If I take the code block out of the timer, it works. I'm a little confused. Any idea whats going on?
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);
});
});
Try this
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);
});
精彩评论