Pop up with greyed out background

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KeredDrahcir
    Contributor
    • Nov 2009
    • 426

    #1

    Pop up with greyed out background

    I'd like to have a link that opens up in a pop up window, but while the window is open, I want to page that linked to it to be greyed out.
    I found a script that would grey out the page but that was deigned to be toggled by a button so I could grey out the page and open the popup but when I closed the popup I couldn't get the page back.
    I tried using a DHTML lightbox that greys out the page but I can only load images and not exteral pages in it.

    Is there a way I can do this? I'm using php but to do this I would like to use JavaScript.
  • Kong Chun Ho
    New Member
    • Jul 2010
    • 34

    #2
    Did u mean a transparent-black layer?
    You can do this using CSS, and close the layer using JS

    Comment

    • KeredDrahcir
      Contributor
      • Nov 2009
      • 426

      #3
      Yes, that right. Can I close the layer by closing the popup window?

      Comment

      • Kong Chun Ho
        New Member
        • Jul 2010
        • 34

        #4
        Yes, of course, just set the obj.className = 'something';

        Comment

        • KeredDrahcir
          Contributor
          • Nov 2009
          • 426

          #5
          I'm not sure I understand. You couldn't give me some sample code please?

          Comment

          • Kong Chun Ho
            New Member
            • Jul 2010
            • 34

            #6
            First, did u mean this effect?

            Comment

            • Kong Chun Ho
              New Member
              • Jul 2010
              • 34

              #7
              There can also a full page layer

              Comment

              • KeredDrahcir
                Contributor
                • Nov 2009
                • 426

                #8
                I want to page to look like a disabled form element.

                Comment

                • Kong Chun Ho
                  New Member
                  • Jul 2010
                  • 34

                  #9
                  So, white background???

                  Comment

                  • Kong Chun Ho
                    New Member
                    • Jul 2010
                    • 34

                    #10
                    Also note, the element(form) behind the black background is disabled!

                    Comment

                    • KeredDrahcir
                      Contributor
                      • Nov 2009
                      • 426

                      #11
                      Yes. I think so.

                      Comment

                      • KeredDrahcir
                        Contributor
                        • Nov 2009
                        • 426

                        #12
                        I found this script to grey out the background.
                        Code:
                        function opacity(id, opacStart, opacEnd, millisec) 
                        { 
                        //speed for each frame 
                          var speed = Math.round(millisec / 100); 
                          var timer = 0; 
                        
                        //determine the direction for the blending, if start and end are the same nothing happens 
                          if(opacStart > opacEnd) 
                          { 
                            for(i = opacStart; i >= opacEnd; i--) 
                            { 
                              setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
                              timer++; 
                            } 
                          //make 'remove' button an 'undo' button
                            add_restore = id+'_remove';
                            restore = document.getElementById(add_restore);
                            restore.innerHTML = "undo";
                            restore.onClick="";
                            restore.onClick="opacity('t1',20,100,500)";
                          } 
                          else if(opacStart < opacEnd) 
                          { 
                            for(i = opacStart; i <= opacEnd; i++) 
                            { 
                              setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
                              timer++; 
                            }
                          //make 'undo' button return to 'remove' button
                            add_restore = id+'_remove';
                            restore = document.getElementById(add_restore);
                            restore.innerHTML = "remove";
                            restore.onClick="";
                            restore.onClick="opacity('t1',100,20,500)"; 
                          } 
                        }
                        //change the opacity for different browsers 
                        function changeOpac(opacity, id) 
                        { 
                          var object = document.getElementById(id).style; 
                          object.opacity = (opacity / 100); 
                          object.MozOpacity = (opacity / 100); 
                          object.KhtmlOpacity = (opacity / 100); 
                          object.filter = "alpha(opacity=" + opacity + ")"; 
                        }
                        It has the greyed out effect I want but I need to be able to set it back when I close the popup rather than using a button as is done here.

                        Comment

                        • KeredDrahcir
                          Contributor
                          • Nov 2009
                          • 426

                          #13
                          Can I use an onclose event that will activate in a different browser?

                          Comment

                          • omerbutt
                            Contributor
                            • Nov 2006
                            • 638

                            #14
                            if you are trying to load an html page which is not outside your domain you can use thickbox here is an example you see here and click onthe link name View Property Detail in front of any of the properties displayed
                            regards,
                            Omer Aslam

                            Comment

                            • KeredDrahcir
                              Contributor
                              • Nov 2009
                              • 426

                              #15
                              Thanks, I'll give it a go. By the way, is there a way to force a page to refresh?

                              Comment

                              Working...