Я действительно новичок в Jquery, и я нашел несколько примеров открытия лайтбокса с помощью файлов cookie и функции загрузки. Я использую пример cookie, который работает с fancybox, но я использовал prettyPhoto на всех своих сайтах и действительно не хочу переходить на fancybox. Я пробовал дюжину разных способов заставить это работать, но мне не повезло. Вот мой код Любая помощь или предложения будут великолепны.
$ (Документ) .ready (функция () {
// !!! SEE THIS PLEASE !!!
// delete this line to make the modal box load only ONCE
// if you let it set to 'false' it will show every time .. set it to 'true' and it will never show
$.cookie("modal", 'false')
/**
* MODAL BOX
*/
// if the requested cookie does not have the value I am looking for show the modal box
if($.cookie("modal") != 'true')
{
alert("sometext");
var где = "http://images.motortrend.com/photo_gallery/112_0611_39z+2006_bugatti_veyron+interior.jpg";
var title = "";
var comment = "";
функция showLbox () {
$ .prettyPhoto.open (где, заголовок, комментарий);
}
// при загрузке страницы показать модальное поле
// больше информации об опциях вы можете найти на сайте fancybox
// in the message is a link with the id "modal_close"
// when you click on that link the modal will close and the cookie is set to "true"
// path "/" means it's active for the entire root site.. if you set it to "/admin" will be active on the "admin" folder
// expires in 7 days
// "modal" is the name i gave the cookie.. you can name it anything you want
$('#modal_close').live('click', function(e) {
e.preventDefault();
$.cookie("modal", "true", { path: '/', expires: 7 });
});
}
});