| | |
Request: Javascript for getting always on top popup window.
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2008
Posts: 148
Reputation:
Solved Threads: 25
I believe you're talking about a "popup" that is more of a modal window then a true popup. This would mean creating a div that is positioned above the page and floats over everything else.
Here's a quick example of how you could do this with jQuery and CSS.
The fixed positioning is solved thanks to an example by stu nicholls at CSS Play. This should leave the div fixed so that it doesnt scroll with the page even on IE 6. IT fades in when the page loads and it fades out when its clicked.
Please don't hesitate to ask any questions if it doesn't make sense.
Here's a quick example of how you could do this with jQuery and CSS.
The fixed positioning is solved thanks to an example by stu nicholls at CSS Play. This should leave the div fixed so that it doesnt scroll with the page even on IE 6. IT fades in when the page loads and it fades out when its clicked.
Please don't hesitate to ask any questions if it doesn't make sense.
html Syntax (Toggle Plain Text)
<!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { //Make the notice DIV display on page load $('#notice').fadeIn(1500); //Register a click event on the DIV[id=notice] and make it fade out. $('#notice').click( function() { $(this).fadeOut(1500); }); }); </script> <style> #notice {display:block; top:200px; left:200px; height:110px; width:276px; position:fixed; border:2px solid black; padding:10px; z-index:1000; background-color:white; display:none;} * html #notice {position:absolute;} </style> <!--[if lte IE 6]> <style type="text/css"> /*<![CDATA[*/ html {overflow-x:auto; overflow-y:hidden;} /*]]>*/ </style> <![endif]--> </head> <body> <div id="notice"> <img src="http://www.google.com/intl/en_ALL/images/logo.gif" /> </div> <!-- write out 10 paragraphs to keep code short --> <!-- there is no other reason to do it this way --> <script type="text/javascript"> for( i=0; i<10; i++) { document.write('<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed gravida lorem ac mi. Morbi non risus vel mi convallis iaculis. Integer ac elit id mi venenatis fringilla. Aliquam aliquet varius nisi. Proin pellentesque risus ac turpis. Nam vestibulum semper mauris. Nullam fermentum, felis sed sagittis volutpat, purus nisl aliquet enim, sit amet blandit mauris lectus eget nisl. Nullam purus erat, consectetur vitae, auctor eget, euismod sed, elit. Vivamus nec tortor a mauris suscipit viverra. Nam malesuada. Ut porta mattis felis. Aenean sed felis. Suspendisse viverra varius arcu. Nunc felis. Donec eget sem in eros rutrum commodo. Vivamus sagittis. Aliquam erat volutpat. </p> '); } </script> </body> </html>
If you're question/problem is solved don't forget to mark the thread as Solved!
-- Code I post is usually but not always tested. If it is tested it will be against 5.2.11 or 5.3.0
-- Code I post is usually but not always tested. If it is tested it will be against 5.2.11 or 5.3.0
![]() |
Similar Threads
- Hidden Link - Please help. (PHP)
- Have to click twice on calendar pop up (C#)
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
- Firefox Compatibility help with script (JavaScript / DHTML / AJAX)
- ASP Form error (ASP)
- get html element value using php (PHP)
- problem in javascript coding in asp page (ASP)
- Pop-Up Calendar for ASP (ASP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Shadowbox not working with dreamweaver Rollover?
- Next Thread: xml to html table v.2
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate array automatically beta box browser calendar captcha captchaformproblem cart close codes column css date debugger decimal dependent design dom download element embed enter error events firefox focus form frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 iframe image() index java javascript javascripthelp2020 jawascriptruntimeerror jquery jsp libcurl listbox maps masterpage media menu microsoft mimic mp4 onerror onmouseover paypal php player position post problem programming prototype rating redirect regex safari scale scriptlets search security select software sql starrating synchronous text textarea toggle unicode validation variables w3c webservice website window windowofwords windowsxp xml





