Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>yensdesign.com - How to create a stuning and smooth popup in jQuery</title>
- <link rel="stylesheet" href="http://www.mywebsite.com/templates/it_theshop/popup/general.css" type="text/css" media="screen" />
- <script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js" type="text/javascript"></script>
- <script type="text/javascript">
- //SETTING UP OUR POPUP
- //0 means disabled; 1 means enabled;
- var popupStatus = 0;
- //loading popup with jQuery magic!
- function loadPopup(){
- //loads popup only if it is disabled
- if(popupStatus==0){
- $("#backgroundPopup").css({
- "opacity": "0.7"
- });
- $("#backgroundPopup").fadeIn("slow");
- $("#popupContact").fadeIn("slow");
- popupStatus = 1;
- }
- }
- //disabling popup with jQuery magic!
- function disablePopup(){
- //disables popup only if it is enabled
- if(popupStatus==1){
- $("#backgroundPopup").fadeOut("slow");
- $("#popupContact").fadeOut("slow");
- popupStatus = 0;
- }
- }
- //centering popup
- function centerPopup(){
- //request data for centering
- var windowWidth = document.documentElement.clientWidth;
- var windowHeight = document.documentElement.clientHeight;
- var popupHeight = $("#popupContact").height();
- var popupWidth = $("#popupContact").width();
- //centering
- $("#popupContact").css({
- "position": "absolute",
- "top": windowHeight/2-popupHeight/2,
- "left": windowWidth/2-popupWidth/2
- });
- //only need force for IE6
- $("#backgroundPopup").css({
- "height": windowHeight
- });
- }
- //---------------cookies-------------------//
- function getCookie(c_name)
- {
- var i,x,y,ARRcookies=document.cookie.split(";");
- for (i=0;i<ARRcookies.length;i++)
- {
- x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
- y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
- x=x.replace(/^\s+|\s+$/g,"");
- if (x==c_name)
- {
- return unescape(y);
- }
- }
- }
- function setCookie(c_name,value,exdays)
- {
- var exdate=new Date();
- exdate.setDate(exdate.getDate() + exdays);
- var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
- //alert(c_value);
- document.cookie=c_name + "=" + c_value;
- }
- function checkCookie()
- {
- var username=getCookie("shoppingKatalog");
- if (username!=null && username!="")
- {
- //
- }
- else
- {
- //centering with css
- centerPopup();
- //load popup
- loadPopup();
- setCookie("shoppingKatalog","istekuva-za-eden-den",321);
- }
- }
- //--------------end cookies---------------//
- //CONTROLLING EVENTS IN jQuery
- $(document).ready(function(){
- checkCookie();
- //LOADING POPUP
- //Click the button event!
- $("#button").click(function(){
- //centering with css
- centerPopup();
- //load popup
- loadPopup();
- });
- //CLOSING POPUP
- //Click the x event!
- $("#popupContactClose").click(function(){
- disablePopup();
- });
- //Click out event!
- $("#backgroundPopup").click(function(){
- disablePopup();
- });
- //Press Escape event!
- $(document).keypress(function(e){
- if(e.keyCode==27 && popupStatus==1){
- disablePopup();
- }
- });
- });
- </script>
- <script type="text/javascript">
- </script>
- </head>
- <body>
- <center>
- <a href="http://www.yensdesign.com"><img src="logo.jpg" alt="Go to yensdesign.com"/></a>
- </center>
- <div id="popupContact">
- <div id="popup_wrap" style="background-image:url('http://www.mywebsite.com/templates/it_theshop/images/popup/shopping-popup1.jpg');height:380px;width:800px;">
- <div style="float:left;width:490px;padding:5px;">
- <h1 style="margin:0px;">??????? ?? <span style="color:#981A32;">90%</span></h1>
- <h2 style="margin:0px;">?????? ?? ????????????? - <span style="color:#981A32;">????!</span></h2>
- <p style="margin:0px;">?????? ???? ???? ?? ?????? ??????? ?????? ?? ?????, ??????, ?????, ?????????, ????????? ?? ????, ??????, ????????... ?? ??? ??? ?? ?????? ?? ????????????? ?????.</p>
- <h4 style="margin:0px;">?????? Newsletter ? ?????????!</h4>
- <form method="post">
- <table class="acymailing_form">
- <p style="color:#981A32;margin:0px;">???????? ?? ????? ?? ??????????? ??? ?????? ?? ?? ????????:</p>
- <tr>
- <td align="left"><input type="checkbox" class="acymailing_checkbox" name="subscription[]" checked="checked" value="1" /><b style="color:#981A32;">???? ??????? ? ?????????</b></td>
- </tr>
- <tr>
- <td align="left"><input type="checkbox" class="acymailing_checkbox" name="subscription[]" value="2" />
- <b style="color:#981A32;">???? ???? ?????????</b></td>
- </tr>
- <tr>
- <td align="left"><input type="checkbox" class="acymailing_checkbox" name="subscription[]" value="4" /><b style="color:#981A32;">???? ???????</b></td>
- </tr>
- <tr style="color:#981A32;">
- <td><label for="user_name">???</label><input id="user_name" type="text" name="user[name]" value="" /></td>
- </tr>
- <tr>
- <td style="color:#981A32;"><label for="user_email">E-????</label><input id="user_email" type="text" name="user[email]" value="" /></td>
- </tr>
- <tr>
- <td><div style="display:none;"><label for="user_html">???????</label></div></td>
- <td><div style="display:none;"><input type="radio" name="user[html]" value="0" id="user_html_0" /><label for="user_html_0">Text</label></div><div style="display:none;"><input type="radio" name="user[html]" value="1" id="user_html_1" checked="checked" /><label for="user_html_1">HTML</label></div></td>
- </tr>
- <tr>
- <td colspan="2">
- <div style="display:none;">
- <input type="radio" name="task" value="optin" checked="checked" id="optin" /><label for="optin">Subscribe</label>
- <input type="radio" name="task" value="optout" id="opftout" /><label for="optout">Unsubscribe</label> </div>
- <input class="button" type="submit" value="??????? ?? ?????????!" name="Submit" style="color: white;background-color: orange;border: 0;border-radius: 5px;height: 30px;font-weight: bold;margin-top:5px;" onclick="setCookie('mywebsite','istekuva-za-godina',364);" /></td>
- </tr>
- </table>
- <input type="hidden" name="gtask" value="sub" style="color:#981A32;" />
- <input type="hidden" name="redirect" value="http://www.mywebsite.com" />
- <input type="hidden" name="option" value="com_acymailing" />
- <input type="hidden" name="visiblelists" value="1,2,4" />
- <input type="hidden" name="hiddenlists" value="YOUR_LISTS" />
- </form>
- </div>
- <img src="http://www.mywebsite.com/templates/it_theshop/images/popup/popust.png" style="float:right;padding-right:-10px;position: absolute;margin-left: 260px;" />
- </div>
- </div>
- <div id="backgroundPopup" style="display : none;">Amti Kriplani</div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement