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
Reply

Join Date: Nov 2008
Posts: 20
Reputation: Narayan15 is an unknown quantity at this point 
Solved Threads: 0
Narayan15 Narayan15 is offline Offline
Newbie Poster

Request: Javascript for getting always on top popup window.

 
0
  #1
Feb 19th, 2009
hi,
I want to build a popup window that should not be minimized and maxmized. that should be always on top. when other window is opened then the pop up window should not be minimized.

Please help meeeeee

thanks in advance
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 149
Reputation: mschroeder is on a distinguished road 
Solved Threads: 25
mschroeder mschroeder is offline Offline
Junior Poster

Re: Request: Javascript for getting always on top popup window.

 
0
  #2
Feb 19th, 2009
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.

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6.  
  7. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
  8. <script type="text/javascript">
  9. $(document).ready(function() {
  10. //Make the notice DIV display on page load
  11. $('#notice').fadeIn(1500);
  12. //Register a click event on the DIV[id=notice] and make it fade out.
  13. $('#notice').click( function() {
  14. $(this).fadeOut(1500);
  15. });
  16. });
  17. </script>
  18. <style>
  19.  
  20. #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;}
  21. * html #notice {position:absolute;}
  22.  
  23. </style>
  24. <!--[if lte IE 6]>
  25. <style type="text/css">
  26. /*<![CDATA[*/
  27. html {overflow-x:auto; overflow-y:hidden;}
  28. /*]]>*/
  29. </style>
  30. <![endif]-->
  31. </head>
  32. <body>
  33. <div id="notice">
  34. <img src="http://www.google.com/intl/en_ALL/images/logo.gif" />
  35. </div>
  36.  
  37. <!-- write out 10 paragraphs to keep code short -->
  38. <!-- there is no other reason to do it this way -->
  39. <script type="text/javascript">
  40. for( i=0; i<10; i++)
  41. {
  42. 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> ');
  43. }
  44. </script>
  45.  
  46. </body>
  47. </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.12 or 5.3.1
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC