Всплывающее окно
Привет, не могу понять как работает скрипт всплывающего окнаhttp://www.lehome.ru/
функционал: работает по таком принципу, окошко с баннером показывается 1 раз и если закрыть то 10 дней не будет показывать, в настройках можно проставить любое кол-во дней сколько хранить куки, еще такой момент, всплывает окошко если зайти в любые 3 раздела на сайте и на 3 раздел всплывает. Так вот не могу заставить его должным образом заработать у себя как в исходном примере: Состоит из: <div class="sly_banner"> <a target="_blank" href="http://www.lehomevintage.ru/ru/lehomevintage/"><img src="/ru/images/vintage.png"></a> </div> <script> jQuery('.sly_banner').click(function(){ jQuery(this).fadeOut(300); jQuery.cookie('pp1',50,{ expires : 10,path : '/' }); // в expires я как понял отвечает за кол-во хранения куки }); jQuery('.sly_banner a img').click(function(e){ var x = e.offsetX==undefined?e.layerX:e.offsetX, y = e.offsetY==undefined?e.layerY:e.offsetY, w = jQuery('.sly_banner a img').width(), h = jQuery('.sly_banner a img').height(); if( w-x<=48&&y<=47 ){ jQuery('.sly_banner').fadeOut(300); jQuery.cookie('pp1',50,{ expires : 10,path : '/' }); return false; }; }); </script> Сам плагин куки /*! * jQuery Cookie Plugin v1.3 * [url]https://github.com/carhartl/jquery-cookie[/url] * * Copyright 2011, Klaus Hartl * Dual licensed under the MIT or GPL Version 2 licenses. * [url]http://www.opensource.org/licenses/mit-license.php[/url] * [url]http://www.opensource.org/licenses/GPL-2.0[/url] */ (function ($, document, undefined) { var pluses = /\+/g; function raw(s) { return s; } function decoded(s) { return decodeURIComponent(s.replace(pluses, ' ')); } var config = $.cookie = function (key, value, options) { // write if (value !== undefined) { options = $.extend({}, config.defaults, options); if (value === null) { options.expires = -1; } if (typeof options.expires === 'number') { var days = options.expires, t = options.expires = new Date(); t.setDate(t.getDate() + days); } value = config.json ? JSON.stringify(value) : String(value); return (document.cookie = [ encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value), options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE options.path ? '; path=' + options.path : '', options.domain ? '; domain=' + options.domain : '', options.secure ? '; secure' : '' ].join('')); } // read var decode = config.raw ? raw : decoded; var cookies = document.cookie.split('; '); for (var i = 0, l = cookies.length; i < l; i++) { var parts = cookies[i].split('='); if (decode(parts.shift()) === key) { var cookie = decode(parts.join('=')); return config.json ? JSON.parse(cookie) : cookie; } } return null; }; config.defaults = {}; $.removeCookie = function (key, options) { if ($.cookie(key) !== null) { $.cookie(key, null, options); return true; } return false; }; })(jQuery, document); Библиоткека jQuery v1.8.3 jquery.com как заставить работать сейчас тупо при обновлении всплывает окошко, при закрытии не сохраняет, я так и не понял , также не смог найти функцию в которой прописано, что бы запускалось окно, если мы зашли в любые три места, и на третий заход оно всплывает. Очень буду признателен любой подсказке |
может кто делал подобное и поделиться
|
Часовой пояс GMT +3, время: 20:36. |