Hi there
Is there anyone who can help a javascript Noob? And explain what is missing in my javascript code, so the pop-up only is displayed once per. session.
Because right now, it pops up every time I click to a new page. And the idea is that it is should work like the business or consumer popup on dustin.com.
Is my Javascrip code.
<!--Modal-->
<!--modalpopup Business eller privat-->
<script>
$(document).ready(function(){
//loads when document is ready
if (document.cookie.indexOf('modal_shown=') >= 0) {
//do nothing if modal_shown cookie is present
} else {
$('.modal').modal('show'); //show modal pop up
document.cookie = 'modal_shown=seen'; //set cookie modal_shown
//cookie will expire when browser is closed
}
})
</script>
<script>
$ts.ready(function()
{
$elm('[data-dismiss="modal"]').onclick = function()
{
$elm('.container').style.display = 'none';
}
});
</script>
<!--test-->
<script>
$ts.ready(function()
{
$elm('[data-dismiss="modal-footer"]').onclick = function()
{
$elm('.container').style.display = 'none';
}
});
</script>
<!---->