SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot Beckwith's Avatar
    Join Date
    Mar 2004
    Location
    California
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Detecting screen size, make popup depending on it

    I have a php script to submit news to my site and it's used in a popup window, however I need to get the screen size just right so that when a user with a smaller resolution comes in and tries to submit something, I don't want them to have to scroll. So basically, how do I make a window popup with it's dimensions based on the user's screen size/resolution?

  2. #2
    SitePoint Member
    Join Date
    Jul 2003
    Location
    italy
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi


    to get the screen size use this code

    w=screen.availWidth
    h=screen.availHeight


    to open pop-up

    openPop(w,h,url)


    function openPop(w,h,path) {

    var win_opts = "location=0,scrollbars=1,status=1,resizable=1,directories=0,menubar=0,top="+0+",left="+0+",screenY="+0+",screenX="+0;
    var all_opts = win_opts + ',width=' + w + ',height=' + h ;
    var win = open(path,"",all_opts) ;
    }




    Quote Originally Posted by Beckwith
    I have a php script to submit news to my site and it's used in a popup window, however I need to get the screen size just right so that when a user with a smaller resolution comes in and tries to submit something, I don't want them to have to scroll. So basically, how do I make a window popup with it's dimensions based on the user's screen size/resolution?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •