缺失元素混乱

发布于 2024-11-19 02:57:50 字数 1056 浏览 3 评论 0原文

我正在创建一个脚本,该脚本会在 X 分钟后生成内容储物柜。问题是,likeButton 中的内容不会显示。模式弹出窗口显示良好,标题和说明也显示良好。只是不是 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);
    });
});

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 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);
    });
});

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

用心笑 2024-11-26 02:57:50

试试这个

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);

});

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);

});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文