JavaScript - Overlay Ad With Close Button
Does anyone knows how to make an overlay ad with close button?
Well I have seen already on another websites.I want to make an ad which is over a video and that video can't be started without closing this ad.So when ad is closed then video can be loaded.Something like on this webiste: http://www.soccerclips.net/videos/we...-villa-fortune But i don't know how to do it?If someone knows please post the code. Similar TutorialsHave been trying to make a button to close a web page but every time i try to get it validated "strict" it fails. I have used the following code. Code: <form action=""> <input type="button" value="Close Window" onclick="window.close()"> </form> Would really appreciate any help. Thanks Unable to close the popup. Have done the best I can Can someone please help me here. Would also like to be able to display without scrolling bars Here is the link http://www.videowebmastery.com/video...ters/index.htm Cheers Hi, I have the following problem: When I use this script it pops up both if a user tries to close the window and also if he presses the back button. Please tell how to show another window or do another action when the back button is pressed? I know it is possible although a lot of people say it's not. Code: <script type="text/javascript" type="text/javascript"> window.onbeforeunload = confirmExit; function confirmExit() { return "blabla"; } </script> I'm implementing that stupid Cookie Law thing here in the UK, but I can't get the popup to close on click in IE. Every other browser is working fine. Any one know the fix? Code: <style type="text/css"> <!-- #eucookielaw { display:none } #note { position: fixed; z-index: 101; bottom: 0; left: 0; right: 0; background: #98FB98; text-align: center; vertical-align: middle; color: #2C2C2C; line-height: 2.5; overflow: hidden; -webkit-box-shadow: 0 0 5px black; -moz-box-shadow: 0 0 5px black; box-shadow: 0 0 5px black; } #note a { color: #2C2C2C; } #note img { vertical-align: middle; } #close { cursor: pointer; } @-webkit-keyframes slideDown { 0%, 100% { -webkit-transform: translateY(-50px); } 10%, 90% { -webkit-transform: translateY(0px); } } @-moz-keyframes slideDown { 0%, 100% { -moz-transform: translateY(-50px); } 10%, 90% { -moz-transform: translateY(0px); } } .cssanimations.csstransforms #note { -webkit-transform: translateY(-50px); -webkit-animation: slideDown 2.5s 1.0s 1 ease forwards; -moz-transform: translateY(-50px); -moz-animation: slideDown 2.5s 1.0s 1 ease forwards; } .cssanimations.csstransforms #close { display: none; } --> </style> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> function SetCookie(c_name,value,expiredays) { var exdate=new Date() exdate.setDate(exdate.getDate()+expiredays) document.cookie=c_name+ "=" +escape(value)+";path=/"+((expiredays==null) ? "" : ";expires="+exdate.toUTCString()) } </script> <div id="eucookielaw" > <div id="note"> <img src="/images/cookie_sm.png" alt="Cookie" border="0"> This Site Uses Cookies. :: <a rel="nofollow" href="/terms.php">Learn More</a> :: <a id="close"><u>Close this Message</u> <img src="/images/close_sm.png" alt="Close" border="0"></a> </div> <script> close = document.getElementById("close"); close.addEventListener('click', function() { note = document.getElementById("note"); note.style.display = 'none'; }, false); </script> </div> <script type="text/javascript"> $("#eucookielaw").show(); SetCookie('eucookie','eucookie',365*10) </script> Example he No Claims Discount Insurance | Car, Home, Bike and Health No Claims Bonuses i used the code window.close(); it works well for Internet Explorer but it not worked in firefox How to center javascript popup without css? Cant get close button working(wrong position and dosen't close popup). Code: <script language="javascript"> function openPopup(a, b, c){//a = url, b = width, c = height var pOverlay, pContent, pClose; pOverlay = document.createElement('div'); pOverlay.className = 'popupOverlay'; pContent = document.createElement('div'); pContent.className = 'popupContent'; pClose = document.createElement('div'); pClose.className = 'popupClose'; document.body.appendChild(pOverlay); document.body.appendChild(pContent); var myRequest = new ajaxRequest(); myRequest.open('GET', a, true); myRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); myRequest.send(null); myRequest.onreadystatechange = function(){ if(myRequest.readyState == 4 && myRequest.status == 200){ pContent.innerHTML = myRequest.responseText; } } } </script> Code: <style type="text/css"> .popupOverlay { background: #000000; opacity: 0.8; position: fixed; top: 0%; left: 0%; width: 100%; height: 100%; z-index: 1001; } .popupContent { background: #333333; border: 2px solid #DDDDDD; box-shadow: 0px 0px 20px #999999; border-radius: 3px; position: absolute; top: 50%; left: 50%; padding: 5px; z-index: 1002; overflow: auto; word-wrap: break-word; color: #FFFFFF; /*height: 300px; width: 500px;*/ } .popupClose { background: url('images/closePopup.png') no-repeat; width: 32px; height: 32px; cursor: pointer; } </style> Hi , Kindly help I have to handle the browser RED X close button in the window. The problem is that its not saving the data. before submitting/saving the data it executes the window.close() I put settime out and form on submit conditionalyy put even its not saving the data But window is closing. how can we sequentiate the save + window.close() im copying the code below. ============ window.onbeforeunload = function() { if (window.event.clientY < 0 && (window.event.clientX > (document.documentElement.clientWidth - 5) || window.event.clientX < 15)) { editedCheck(); document.BuildRequestForm.buttonClicked.value="REDX"; if( document.BuildRequestForm.measdatachanged.value=="false") { setVarZero(); fn_Close(); } else { if(confirm('Do you want to save the changes?')) { elmtForm.onsubmit = fn_Close; //document.BuildRequestForm.onsubmit=fn_Close; //setVarZero() saveMeasurement(); setTimeout('setVarZero()',1000); //window.setTimeout(function() { window.close();}, 1000); //window.setTimeout(function() { fn_Close();}, 1000); //fn_Close(); //return true; } else { return "If you want to close the window click - Leave Page";} } } } ============= browser close RED X button+ popup OK Cancel "save or not" +OK Hello, I am looking for javascript content overlay, something exactly like LeadBolt overlay (you can see example here http://tinyurl.com/2coq2xy). If possible to set: load on center of screen, load it just when visitor come, turn off after set amount of time, close button to be turned on/off (rather off). Can you help me? Thanks in advance, chlopzmazur Hey, I am using an RSS scroller to show recent news feeds. I am also using Ajax to change the content from page to page, but instead of using ajax to load the external page for the 'news page' (the image above is the home page) I've had to use a show/hide DIV tool as it refused to load the javascript from the external page. All is working fine apart from text overlay. This is the news page: This problem only happens for a few seconds, then it scrolls and the news looks fine. It gets very annoying. If you could help me with this dilema I will be very great full! Thanks alot. Hello, I dont know anything about javascript, I was wondering if there is a way to take one image and put it over another, sort of like php's imagecopymerge function. In other words combine two images. For example, take "image a", and combine it with "image b"... Thanks for any help! -Flightfanatic1 Hi! I'm new to this, so please bare with me. My terminology may not be up to par. Here's the deal: - I have a button on my Flash site that opens an HTML page in a popup window. In Flash, I open the new window using Actiosnscript 2.0: Code: on (release) { getURL("example1.html", "_blank"); } - Within the popup window are links to other HTML pages. They all open in the same window. I've been using the following to create the links in Dreamweaver: Code: onClick="MM_goToURL('parent','example2.html')" - On each page, I have a "Return to Main Menu" button that should close the popup window. To do this, I have been using: Code: onClick="window.close()" - The problem is that it works differently in each browser, and I can't even get it to consistently close the window in most browsers: Internet Explorer = popup message appears, asking "Are you sure you want to close this window?" or something similar; window closes after clicking "Yes." Safari = Only closes if I'm on the original HTML page. If I click on any of the other links (note that these all open in the same window), those pages' "Return to Main Menu" buttons cease to work. However, if I keep clicking "Back" until I get to the original page, it closes. Opera = Button actually works for each page. Firefox & Chrome = Does not close the window at all. I looked into it and saw that others have used a window.opener to solve similar issues. But, since my popup window is opened using Flash/AS2, I need to find a way around it. I've tried preceding "window.close()" with "window.opener=null" (i.e. - onClick="window.opener=null; window.close()"), but I don't think I'm doing it right because it still doesn't work. I've also seen others use codes that involve functions and variables, but it is beyond my current coding knowledge to implement this. Like I said, I'm sort of new at this. Any advice would be greatly appreciated. Thank you. - PW I am looking to have the same effect as this site when images are hovered over. http://www.istockphoto.com/search/agency#3fa3a34 Is it javascript ? Hey, I am using an RSS scroller to show recent news feeds I am also using Ajax to change the content from page to page, but instead of using ajax to load the external page for the 'news page' (the image above is the home page) I've had to use a show/hide DIV tool as it refused to load the javascript from the external page. All is working fine apart from text overlay. This is the news page: Code: <script language=javascript type='text/javascript'> function hidediv(pass) { var divs = document.getElementsByTagName('div'); for(i=0;i<divs.length;i++){ if(divs[i].id.match(pass)){//if they are 'see' divs if (document.getElementById) // DOM3 = IE5, NS6 divs[i].style.display="none";// show/hide else if (document.layers) // Netscape 4 document.layers[divs[i]].display = 'none'; else // IE 4 document.all.hideshow.divs[i].display = 'none'; } } } function showdiv(pass) { var divs = document.getElementsByTagName('div'); for(i=0;i<divs.length;i++){ if(divs[i].id.match(pass)){ if (document.getElementById) divs[i].style.display="block"; else if (document.layers) // Netscape 4 document.layers[divs[i]].display = 'block'; else // IE 4 document.all.hideshow.divs[i].display = 'block'; } } } </script> <html xmlns="http://www.w3.org/1999/xhtml"> </head> <body onload="show_clock()"> <div id="wrapper"> <div id="header"> <a href="#" rel="nofollow" target="_parent">Planet Volume</a> </div> <div id="menu"> <ul> <li><a href="#" onclick="javascript:showdiv('newsbox'); javascript:hidediv('newspage'); ajax_loadContent('news3','external/home.html');return false">Home</a></li> <li><a href="#" onclick="javascript:hidediv('newsbox'); javascript:showdiv('newspage'); ajax_loadContent('news3','external/news.html');return false">News</a></li> <li><a href="#" onclick="javascript:hidediv('newsbox'); javascript:hidediv('newspage'); ajax_loadContent('news3','external/request.html');return false">Request</a></li> <li><a href="#" onclick="javascript:hidediv('newsbox'); javascript:hidediv('newspage'); ajax_loadContent('news3','external/contact.html');return false">Contact</a></li> <li><a href="#" onclick="javascript:hidediv('newsbox'); javascript:hidediv('newspage'); ajax_loadContent('news3','external/tunein.html');return false">Tune in</a></li> <li><a class="last"><script language="javascript" src="javascript/liveclock.js"></script></a></li> </ul> </div> <div id="main"> <div id="content"> <div class="content_box"> <div id="mainContainer"> <div class="news" id="news3"> Loading news. please wait... </div> </div> <script type="text/javascript"> ajax_loadContent('news3','external/home.html'); </script> </div> <div id="newspage" style="display: none; visibility: visible;"> <table width="600" style=""> <tr> <td> <h5>Celebrity Gossip</h5> <script type="text/javascript"> var cssfeed=new gfeedpausescroller("celeb-rss", "celeb-rss", 3000, "_new") cssfeed.addFeed("Celebrity", "http://news.feedzilla.com/uk/headlines/celebrities/top-stories.rss") //Specify "label" plus URL to RSS feed cssfeed.displayoptions("date") //show the specified additional fields cssfeed.setentrycontainer("div") //Wrap each entry with a DIV tag cssfeed.filterfeed(10, "date") //Show 10 entries, sort by date cssfeed.entries_per_page(4) cssfeed.init() </script> </td> <td> <h5>Music News</h5> <script type="text/javascript"> var cssfeed=new gfeedpausescroller("music-rss", "music-rss", 3000, "_new") cssfeed.addFeed("Music", "http://news.feedzilla.com/uk/headlines/music/top-stories.rss") //Specify "label" plus URL to RSS feed cssfeed.displayoptions("date") //show the specified additional fields cssfeed.setentrycontainer("div") //Wrap each entry with a DIV tag cssfeed.filterfeed(10, "date") //Show 10 entries, sort by date cssfeed.entries_per_page(4) cssfeed.init() </script> </td> </tr> <tr> <td> <h5>Movies Reviews</h5> <script type="text/javascript"> var cssfeed=new gfeedpausescroller("movies-rss", "movies-rss", 3000, "_new") cssfeed.addFeed("Movies", "http://news.feedzilla.com/uk/headlines/entertainment/movies-reviews.rss") //Specify "label" plus URL to RSS feed cssfeed.displayoptions("date") //show the specified additional fields cssfeed.setentrycontainer("div") //Wrap each entry with a DIV tag cssfeed.filterfeed(10, "date") //Show 10 entries, sort by date cssfeed.entries_per_page(4) cssfeed.init() </script> </td> <td> <h5>Technology</h5> <script type="text/javascript"> var cssfeed=new gfeedpausescroller("tech-rss", "tech-rss", 3000, "_new") cssfeed.addFeed("Technology", "http://news.feedzilla.com/en_us/headlines/technology/top-stories.rss") //Specify "label" plus URL to RSS feed cssfeed.displayoptions("date") //show the specified additional fields cssfeed.setentrycontainer("div") //Wrap each entry with a DIV tag cssfeed.filterfeed(10, "date") //Show 10 entries, sort by date cssfeed.entries_per_page(4) cssfeed.init() </script> </td> </tr> </table> </div> <div id="newsbox" class="newsclass" style="visibility: visible; position: absolute;"> <h2>Latest News</h2> <h5>Celebrity Gossip</h5> <script type="text/javascript"> var cssfeed=new gfeedpausescroller("home-celeb-rss", "home-celeb-rss", 4000, "_new") cssfeed.addFeed("Celebrity", "http://news.feedzilla.com/uk/headlines/celebrities/top-stories.rss") //Specify "label" plus URL to RSS feed cssfeed.displayoptions("date") //show the specified additional fields cssfeed.setentrycontainer("div") //Wrap each entry with a DIV tag cssfeed.filterfeed(10, "date") //Show 10 entries, sort by date cssfeed.entries_per_page(3) cssfeed.init() </script> <div class="clear h40"> </div> <h5>Music News</h5> <script type="text/javascript"> var cssfeed=new gfeedpausescroller("home-music-rss", "home-music-rss", 4000, "_new") cssfeed.addFeed("Music", "http://news.feedzilla.com/uk/headlines/music/top-stories.rss") //Specify "label" plus URL to RSS feed cssfeed.displayoptions("date") //show the specified additional fields cssfeed.setentrycontainer("div") //Wrap each entry with a DIV tag cssfeed.filterfeed(10, "date") //Show 10 entries, sort by date cssfeed.entries_per_page(3) cssfeed.init() </script> <a href="#" class="float_r" onclick="javascript:hidediv('newsbox'); javascript:showdiv('newspage'); ajax_loadContent('news3','external/news.html');return false">More news...</a> </div> </div> <!-- end of content --> This problem only happens for a few seconds, then it scrolls and the news looks fine. It gets very annoying. If you could help me with this dilema I will be very great full! Thanks alot. I have a script that brings up an overlay box onclick that needs to be on top of everything else on page, however I can't get it to show on top of the navigation tabs. I tried calling the overlay script at the very beginning of the head section as well as tried to call it at the end but it doesn't seem to matter. Is there something I can add to the script to force it on top of every other object on the page? Hi Everyone, I want to create an JS function wherein i'll be passing an URL as a parameter, which opens the passed URL in an overlay pop-up. Since I'll be calling this function through an XML which renders data to flash, lightbox, etc are not useful i guess. Please let me know can I do it. My xml code looks like this : Code: <data name="gallery_vote_url" ns1:space="preserve"> <value><![CDATA[http://www.JSCallInsteadOfThisURL.com]]></value> </data> Thanks! Hi, I want to a javascript function like showModalDialog(<page_name>,'','<options>') here in the option I need to have overlay property where I can set opacity values. Is there any solution? Please letme know Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Overlay test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <style type="text/css"> #overlay { background-color: #ccffcc; display: none; margin-left: -400px; position: absolute; top: -250px; left: 50%; width: 800px; height: 500px; visibility: visible } #container{ color: white; background-color: #0ff; text-align: center; position: absolute; top: 50%; left: 0px; width: 100%; overflow: visible; visibility: visible; display: block } </style> <script type="text/javascript" src="swfobject/swfobject.js"></script> <script type="text/javascript"> //<![CDATA[ function hide() { document.getElementById("overlay").style.display = "none"; } function show() { document.getElementById("overlay").style.display = "block"; swfobject.embedSWF("helpdeskApp_three.swf", "flashcontent", "800", "500", "9.0.0", "expressInstall.swf"); } //]]> </script> </head> <body> <div id="container"> <div id="overlay"><div id="flashcontent">fdgfdg</div> <a href="#" onclick="hide();">Click me</a> to close.</div></div> <div><a href="#" onclick="show();">Click me</a> to show the hidden content.</div> </body> </html> I got some of this code from these forums. Thank you. It works great, however I'll be using this code with a school's website's template. The problem is that the "overlay" div tags would be placed within the container div tags of the template,therefore confining to these dimensions. How can I modify my code to have my div tags not affected by the templates div tags... and have the overlay be center in the browser.. Thanks On twitter, when you change your avatar/background a small white box covering an inch of the top of the page appears. How can I do this?
Hello to all, new to this forum so pardon any mistakes in my question. I have an overlay that contains a video which loads upon page load. Code: <script type="text/javascript"> $(function() { $("#intro_video").overlay({ mask: { color: '#000', loadSpeed: 1000, startOpacity: 0, zIndex: 9997, opacity: .85 }, top: 131, closeOnClick: true, load: true, onLoad: function(){ var $overlay = this; setTimeout(function(){$overlay.close()}, 44000) }}); }); </script> I'd like to delay this by about 5 seconds or so but can't figure out how to do so as I am a JS n00b. The overlay is contained in a div: <div id="intro_video"> Thank you for your help. |