Недостаток пропущенного элемента - PullRequest
0 голосов
/ 07 июля 2011

Я создаю скрипт, который производит блокировку контента через 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);
    });
});

1 Ответ

1 голос
/ 07 июля 2011

Попробуйте это

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

});
...