I'm trying to figure out the best way to do a one-time homepage lightbox popup containing a simplenews signup box. I figure I'd need to use lightbox2 to display the simplenews block, then set a cookie so the user only sees it once.

Can anyone recommend a strategy for building this?

Comments

globalplayer’s picture

Any progress with this ?

kruser’s picture

It was a bit tricky - I ended up using jquery to trigger a hidden link on the homepage which would open up a lightbox window containing the newsletter subscribe block from another page. I also added in jquery.cookie.js to make the lightbox only open on the first viewing.

<a href="/node/988 #newsletter-block-div > *" rel="lightmodal[|width:300px;height:245px;]" id="auto"  style="display: none;"> </a>
<script type="text/javascript" src="/sites/all/themes/customtheme/js/jquery.cookie.js"></script>
<script type="text/javascript">
    //<![CDATA[ 
    $(document).ready(function(){
        // if the requested cookie does not have the value I am looking to show the modal box
            
		if($.cookie("modal") != 'true')
		{
			$("#auto").trigger('click');
			$.cookie("modal", "true", { path: '/', expires: 30 });  
		}
			
       });
    //]]> 	
    </script>    

-----------------------------------------------------
Bob @ Drupal Aid (https://www.drupalaid.com)