Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <!--
- Author: Affbuddy
- Site: https://affbuddy.com/
- Youtube: https://www.youtube.com/watch?v=fQ7xaKfMWcs
- -->
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta name="robots" content="noindex, nofollow">
- <title>jQuery Exit Pop Script</title>
- <link rel="shortcut icon" href="images/favicon.ico">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
- <style>
- @import url(https://fonts.googleapis.com/css?family=Bangers);
- body {
- text-align: center;
- }
- .header {
- margin: auto;
- margin-bottom: 30px;
- padding-top: 10px;
- height: 120px;
- background-color: #2a3a47;
- }
- .logo {
- margin: auto;
- background-image: url(https://s3.amazonaws.com/affbuddy/logo.png);
- background-repeat: no-repeat;
- width: 315px;
- height: 100px;
- }
- .title {
- font-family: 'Bangers', cursive;
- margin-bottom: 60px;
- }
- .panel {
- margin: auto;
- min-height: 300px;
- max-width: 400px;
- border: 6px dashed #ff0000;
- cursor: pointer;
- }
- .panel-body {
- font-size: 20px;
- }
- /* DOWNSELL STYLES */
- .backdrop {
- position: fixed;
- z-index: 998;
- top: 0 !important;
- bottom: 0 !important;
- left: 0;
- width: 100%;
- min-height: 100%;
- background: rgba(0, 0, 0, .5);
- }
- .downsell {
- position: fixed;
- z-index: 999;
- top: 50%;
- left: 50%;
- width: 680px;
- height: 400px;
- margin: -200px 0 0 -340px;
- background-repeat: no-repeat;
- background-position: 50% 0;
- -webkit-box-shadow: 0 0 20px 0 rgba(0,0,0,0.5);
- box-shadow: 0 0 20px 0 rgba(0,0,0,0.5);
- border-radius: 7px;
- cursor: pointer;
- }
- .downsell {
- background-image: url('https://s3.amazonaws.com/affbuddy/downsell.jpg');
- }
- .close-btn {
- position: absolute;
- z-index: 1000;
- top: -10px;
- right: -10px;
- width: 32px;
- height: 32px;
- }
- .hide {
- display: none;
- }
- </style>
- <!--[if IE]>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
- <![endif]-->
- </head>
- <body>
- <div class="header">
- <div class="container">
- <div class="logo"></div>
- </div>
- </div>
- <div class="container">
- <h1 class="title">jQuery Exit Pop Script</h1>
- <div class="panel panel-default" data-href="http://example.com">
- <div class="panel-body">
- <h1>Mega Store Coupon</h1>
- <h2>Save 50% to 90%</h2>
- <br />
- <h2><a href="#">CLICK HERE</a></h2>
- </div>
- </div>
- </div><!-- container -->
- <!--DOWNSELL - START-->
- <div class="backdrop hide" style="top: 0px;"></div>
- <div class="downsell hide" data-href="http://example.com">
- <img class="close-btn" src="https://s3.amazonaws.com/affbuddy/close.png" />
- </div>
- <script>
- window.beforeunload_message = "LIMITED TIME SPECIAL OFFER\n\nClick 'STAY ON THIS PAGE' below to activate offer or 'LEAVE THIS PAGE' if you are not interested.";
- </script>
- <!--DOWNSELL - END-->
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
- <script>
- $(function() {
- window.onbeforeunload = function (e) {
- /* NOTHING TO CHANGE HERE */
- $('.backdrop, .downsell').removeClass('hide');
- var top = $(window).scrollTop();
- $('.backdrop').css({'top': top});
- /* CLOSES BACKDROP AND IMAGE ON CLICK
- $('.backdrop, .downsell').click(function() {
- $('.backdrop, .downsell').addClass('hide');
- }); */
- /* MAKES DOWNSELL IMAGE INTO A LINK */
- $(".downsell").click(function() {
- window.onbeforeunload = null; // STOPS THE DOWNSELL TRIGGER
- window.location.href = ($(this).data("href"));
- });
- /* NOTHING TO CHANGE HERE */
- e = e || window.event;
- if (e) {
- e.returnValue = window.beforeunload_message;
- }
- return window.beforeunload_message;
- };
- });
- $(function(){
- /* MAKES PANEL INTO A LINK */
- $(".panel").click(function() {
- window.onbeforeunload = null; // STOPS THE DOWNSELL TRIGGER
- window.location.href = ($(this).data("href"));
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement