SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Req: Javascript solution to window resize issue

    Hi Masters

    I have a problem with layers and IE size + windows resolution. u can check my post http://www.sitepoint.com/forums/showthread.php?t=464303

    Now, i am seeking a solution through Javascript. If that hs posible to check the resolution and windows size and then set the X,Y of the layer "Trans".

    Moreover, when the user resize the window, it will set the X, Y of that layer again to place it on accurate location. u can check and download the above page. to look the code.

    I shall remain thankful through out my life.

    Regards !!

  2. #2
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey any one please reply to this problem i am really want some solution,.

  3. #3
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I thought you said "no tables"?

    That's an interesting application, but your page is throwing all kinds of Javascript errors.

    Here's one problem (there may be others):
    Code:
    function XY(e) {
       X = (window.Event)? e.pageX : event.clientX;
       Y = (window.Event)? e.pageY : event.clientY;
       ...
    It should be something like this (but this is not the only way):
    Code:
    function XY(e) {
       e = e || window.event;
       X = e.pageX || e.clientX || 0;
       Y = e.pageY || e.clientY || 0;
       ...
    Also note that clientX/clientY are not the same as pageX/pageY. clientX/clientY need to have scrollLeft/scrollTop added to them.
    For reference: xScrollLeft, xScrollTop, xEvent.

    As for your question...

    The TD which contains #mapa and #imagen has a hard-coded width. So I don't think that TD is changing size on window resize. You have other problems, like the one I mentioned above. Nevertheless, if you want want to try it, add a 'resize' handler at the end of the 'load' function in 'mapa.js':
    Code:
    function load()
    {
      ...
      window.onresize = winOnResize; // or use something like xAddEventListener
    }
    function winOnResize()
    {
      // get width of container TD
      // set new width for #mapa
      // set new width for #imagen
    }
    Why are you floating #mapa? That's asking for trouble when there's no need for it.

    For reference: xAddEventListener, xWidth.

  4. #4
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    many thanks for your reply. this solves the resize issue. But one more thing is there. That is mu windows resolution is 1024x768 and i put all the properties on mapa, imagen, and trans layer based on my resolution. Now there is a user whose windows resolution is 1280x1024 or anything but not 1024x768 then obviously it will not be align. So what would u suggest to solve that problem ???

    Once again thanks a lot.

  5. #5
    if ($zee == "Guru") { $zee--;}
    Join Date
    Nov 2005
    Location
    Karachi - Pakistan
    Posts
    1,133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks a lot for all your support, the problem has been solved by using a CONTAINER LAYER and al the other layers like mapa, trans etc inside the container layer.

  6. #6
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good work


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
  •