PDA

Zobacz pełną wersję : problem z dodaniem popup jQuery



Qbik
13-11-2012, 14:56
chciałem wrzucić popup w jQuery i niestety nie mogę go wywołać na stronie

na stronie zainstalowany jest plugin System - jQuery++ Integrator by tushev.org

włączony jest tryb jQuery noConflict mode

jest adnotacja o dostosowaniu skryptu, ale niestety nie wiem o jakie dostosowanie chodzi, jak ktoś mógłby podpowiedzieć będę wdzięczny

to jest plik popup.js

/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/

/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/

/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};

a to pliku wywołującego

<div id="OknoPanel">

<div class="cookie-notice-dialog" style="visibility:hidden;" >
<a class="close-button" href="?hide-okno=1">&times;</a>
<a class="text-close-button" href="drugie_okno.html">
<H3 class="naglowek_popup">UWAGA, <br />
To jest okienko POPUP!</H3>
<p>
jakiś tekst w okienku PopUp</p>
<p>po zapoznaniu kliknij gdzieś w okienku</p>
</a>
<!--
<p><a class="text-close-button" href="">ZAMKNIJ</a></p>
-->
</div>

<script type="text/javascript">
$(document).ready(function() {

var $cookieNoticeDialog = $('div.cookie-notice-dialog');
var bottomPos = $cookieNoticeDialog.css('bottom');
$cookieNoticeDialog.css('bottom', '-200px'); // hide initially

//if the cookie is set, do not show the box.
if( $.cookie('hide-cookie-notice') != '1')
{
$cookieNoticeDialog.css('visibility', 'visible');


$cookieNoticeDialog.delay(200).animate({
bottom: bottomPos
}, 500, 'swing');

$('div.cookie-notice-dialog a.close-button').click(function(event) {
event.preventDefault();
// store a cookie to prevent showing this dialog in future
$.cookie('hide-cookie-notice', '1', { expires: 365, path: '/' });
$cookieNoticeDialog.fadeOut(500);
});
$('div.cookie-notice-dialog a.text-close-button').click(function(event) {
// store a cookie to prevent showing this dialog in future
$.cookie('hide-cookie-notice', '1', { expires: 365, path: '/' });
});
}
});
</script>

</div>

<script type="text/javascript">
var addthis_config = {
data_use_cookies: false
}
</script>


korzystam z template JA Purity II

link do skryptu popup.js dodałem w pliku header.php

a drugi kod w footer.php


poniżej paczka ze skryptem i jak to ma wyglądać - efekt dostępny po otworzeniu popup_cookie.html