PDA

View Full Version : Adding Cookies to a Jquery delayed POPup



scottyc1
09-12-2015, 09:43 PM
I am a novice web-designer who can usually pull apart a website to figure out how it works, but I have been researching for 2 days now and I feel I need to ask for some help regarding setting up cookies.

What I am looking to do it have a Delayed popup appear on my page, but I would like it to appear only once every 15 minutes. I have worked out the delayed popup and have a sample here http://2-jobsearch.com/sample

I just need to know how to merge the cookie code into my current popup code..

Here is what I have now..



<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>sample</title>

<!-- Force latest IE, Google Chrome Frame for IE -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">


<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- Bootstrap styles -->
<link rel="stylesheet" href=" bootstrap.min.css">

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-1.8.2.min.js">
</script>

<script src="js.cookie.js"></script>
<!-- jQuery Popup Overlay -->
<script src="jquery.popupoverlay.js"></script>

<!-- Custom styles for the demo page -->
<style>
pre.prettyprint {
padding: 9px 14px;
}
.fulltable {
max-width: 100%;
overflow: auto;
}
.container {
padding-left: 0;
padding-right: 0;
}
.lineheight {
line-height: 3em;
}

color: #fff;
}
.page-header {
border-bottom: none;
}
.initialism {
font-weight: bold;
letter-spacing: 1px;
font-size: 12px;
}

.initialism1 { font-weight: bold;
letter-spacing: 1px;
font-size: 12px;
}
</style>
</head>
<body>

<!-- Set defaults -->
<script>
$(document).ready(function () {
$.fn.popup.defaults.pagecontainer = '.container'
});
</script>

<!-- Fade & scale -->

<div id="fadeandscale" class="well">

<pre class="prettyprint"> This is the POPUP window </pre>

<button class="fadeandscale_close btn btn-default">Close</button></div>

<script>
setTimeout(function(){
$('#fadeandscale').popup({
opacity: 0.5,
autoopen: true,
transition: 'all 3.3s'
});
},5000);
</script>

</body>
</html>




I would appreciate any help or thoughts on a solutions or if this question has been asked and solved, please let me know as I could not find the answer.

Thanks Scott

Beverleyh
09-13-2015, 12:50 AM
I just need to know how to merge the cookie code into my current popup code.
Where is your cookie code? I can see a jquery cookie plugin but no code to create or read the cookie.

If you're not sure how to use the jquery cookie plugin, start by searching tutorials - "jquery cookie plugin tutorial" brings up plenty of examples.

scottyc1
09-13-2015, 03:13 AM
Where is your cookie code? I can see a jquery cookie plugin but no code to create or read the cookie.

If you're not sure how to use the jquery cookie plugin, start by searching tutorials - "jquery cookie plugin tutorial" brings up plenty of examples.

Hello beverleyh

Thank you for your response.

I had thought that since I could not figure out how to merge the Jquery cookie code with my Jquery popup code , I would post what I had working correctly and add any suggestions to that code.

Believe me, I have either been searching the wrong tutorials or it's so simple that I can't see the forest through the trees.

Beverleyh
09-13-2015, 07:38 AM
I could not figure out how to merge the Jquery cookie code with my Jquery popup code
So do you have code for writing, getting and reading a cookie using that plugin? Start by posting that, and if you're still not sure how to integrate it with your popup, somebody can attempt to help you then.

You need to at least give us something to work with. Having followed X tutorial for using the cookie plugin, please also post a link to that tutorial so that we can follow what you're doing.

You see, the problem in posting for help with a jquery plugin in this forum, is that you're relying on and assuming that we have knowledge of that plugin too. Other members here (of the helpful responders) *may* have used the cookie plugin before, but if they haven't, you're essentially relying on the goodwill of somebody else to research/learn about the plugin, how to use it, to write the code and apply it on your behalf, and that's unrealistic. Give us something to work with (i.e. Working examples and documentation) and the likelihood of help increases, although it's more likely that you'll get help from the developers of the plugin or the jquery community.