<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: [CSS/Javascript] How do I create full page overlay ad that covers the page when user first enter (similar to news.com)?</title>
	<link>http://ask.metafilter.com/81646/CSSJavascript-How-do-I-create-full-page-overlay-ad-that-covers-the-page-when-user-first-enter-similar-to-newscom/</link>
	<description>Comments on Ask MetaFilter post [CSS/Javascript] How do I create full page overlay ad that covers the page when user first enter (similar to news.com)?</description>
	<pubDate>Tue, 22 Jan 2008 10:01:04 -0800</pubDate>
	<lastBuildDate>Tue, 22 Jan 2008 10:01:04 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: [CSS/Javascript] How do I create full page overlay ad that covers the page when user first enter (similar to news.com)?</title>
		<link>http://ask.metafilter.com/81646/CSSJavascript-How-do-I-create-full-page-overlay-ad-that-covers-the-page-when-user-first-enter-similar-to-newscom</link>	
		<description>How do I create full page overlay ad that covers the page when user first enter (similar to news.com)?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2008:site.81646</guid>
		<pubDate>Tue, 22 Jan 2008 09:08:55 -0800</pubDate>
		<dc:creator>parttimeninja</dc:creator>
		
			<category>full</category>
		
			<category>screen</category>
		
			<category>page</category>
		
			<category>ad</category>
		
			<category>newscom</category>
		
	</item> <item>
		<title>By: MarkLark</title>
		<link>http://ask.metafilter.com/81646/CSSJavascript-How-do-I-create-full-page-overlay-ad-that-covers-the-page-when-user-first-enter-similar-to-newscom#1209810</link>	
		<description>There are a few different options for you on &lt;a href=&quot;http://miniajax.com/&quot;&gt;this&lt;/a&gt; page.  Quite a few &apos;full page overlays&apos;, I&apos;m sure one will fit the bill.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.81646-1209810</guid>
		<pubDate>Tue, 22 Jan 2008 10:01:04 -0800</pubDate>
		<dc:creator>MarkLark</dc:creator>
	</item><item>
		<title>By: MarkLark</title>
		<link>http://ask.metafilter.com/81646/CSSJavascript-How-do-I-create-full-page-overlay-ad-that-covers-the-page-when-user-first-enter-similar-to-newscom#1209813</link>	
		<description>BTW those are all ajax applications, but shouldn&apos;t be too difficult to implement.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.81646-1209813</guid>
		<pubDate>Tue, 22 Jan 2008 10:01:48 -0800</pubDate>
		<dc:creator>MarkLark</dc:creator>
	</item><item>
		<title>By: ook</title>
		<link>http://ask.metafilter.com/81646/CSSJavascript-How-do-I-create-full-page-overlay-ad-that-covers-the-page-when-user-first-enter-similar-to-newscom#1209921</link>	
		<description>If you don&apos;t want to get into digging through somebody else&apos;s ajax code to pull out only the parts you need, the simplest way to do this is the following.   (I&apos;m not worrying too much here about compatibility with old browsers, coping with users who have javascript disabled, etc; none of this is tested;  this is just to give you a rough idea of the process.)&lt;br&gt;
&lt;br&gt;
1) As the first thing in your HTML, include a hidden div which contains your ad positioned where you want it:&lt;br&gt;
&lt;br&gt;
&amp;lt;div id=&quot;hugeAnnoyingAdvertisement&quot; style=&quot;z-index:999; position:absolute; width:100%;height:100%; display:none&quot;&amp;gt;your ad here&amp;lt;/div&amp;gt;&lt;br&gt;
&lt;br&gt;
Everything in the style attribute will position the ad; adjust to taste.  You use display:none so it won&apos;t appear by default for everyone.&lt;br&gt;
&lt;br&gt;
2) In your body onLoad, call a javascript function which will make that div visible:&lt;br&gt;
&lt;br&gt;
function showTheHugeAnnoyingAdvertisement() {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var theAd = document.getElementById(&apos;hugeAnnoyingAdvertisement&apos;);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theAd.style.display=&apos;block&apos;;&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
3) Make sure that somewhere inside that ad div is a link which allows the user to hide it again (by calling a function which is basically the same as the above, except that it it will set the display back to &apos;none&apos;.)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
At this point you have an ad which will appear every time the page loads.  This will get old real fast; what you probably want is to only show it if it hasn&apos;t been seen before (or if it hasn&apos;t been seen within a set amount of time.)  To track this, you&apos;ll want to set a cookie after displaying the ad -- and test for the presence of that cookie before displaying it: if there&apos;s a cookie, that means the user has already seen it, so don&apos;t display it.    So change that function to something like&lt;br&gt;
&lt;br&gt;
function showTheHugeAnnoyingAdvertisement() {&lt;br&gt;
&amp;nbsp;&amp;nbsp;if (document.cookie.indexOf(&apos;hasAlreadySeenTheAd&apos;) == -1) {&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var theAd = document.getElementById(&apos;hugeAnnoyingAdvertisement&apos;);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theAd.style.display=&apos;block&apos;;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;document.cookie=&quot;hasAlreadySeenTheAd;path=/&quot;;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
To make the ad recur periodically add an expiration date when writing the cookie.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.81646-1209921</guid>
		<pubDate>Tue, 22 Jan 2008 11:11:36 -0800</pubDate>
		<dc:creator>ook</dc:creator>
	</item><item>
		<title>By: ook</title>
		<link>http://ask.metafilter.com/81646/CSSJavascript-How-do-I-create-full-page-overlay-ad-that-covers-the-page-when-user-first-enter-similar-to-newscom#1209930</link>	
		<description>(I want to reiterate that I took many shortcuts in the above sample code; you probably don&apos;t want to just copy and paste this into a production site.    &lt;br&gt;
&lt;br&gt;
You may want to look into one of the code libraries such as Prototype.js, which simplifies a lot of tasks and makes it easier to write cross-compatible code -- I&apos;m to the point now where I feel crippled when I&apos;m not using it :)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.81646-1209930</guid>
		<pubDate>Tue, 22 Jan 2008 11:17:11 -0800</pubDate>
		<dc:creator>ook</dc:creator>
	</item><item>
		<title>By: parttimeninja</title>
		<link>http://ask.metafilter.com/81646/CSSJavascript-How-do-I-create-full-page-overlay-ad-that-covers-the-page-when-user-first-enter-similar-to-newscom#1209963</link>	
		<description>Thank you ook! This will gives me a good start.&lt;br&gt;
&lt;br&gt;
MarkLark, thanks for the link. That is a great site.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.81646-1209963</guid>
		<pubDate>Tue, 22 Jan 2008 11:33:05 -0800</pubDate>
		<dc:creator>parttimeninja</dc:creator>
	</item>
	</channel>
</rss>
