Jump to content

Recommended Posts

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>

<!---->

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...