Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. DHTML div dilemma

DHTML div dilemma

Scheduled Pinned Locked Moved Web Development
question
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nino_1
    wrote on last edited by
    #1

    Hi All, I'm attempting to center three div layers within a tabbed view, I'm using a function that was written by a co-worker which is great but I cannot find out were to callout the "resize" within the code. Here is what I have for the function: function centerDivs(){ widthOfDiv = '720'; //put the div width into variable centeringTheDiv = (screen.width) ? (screen.width-widthOfDiv)/2 : 0; //find out where the middle is widthwise //do this for each div layer document.all["LayerOne"].left = centeringTheDiv; document.all["LayerTwo"].left = centeringTheDiv; document.all["LayerThree"].left = centeringTheDiv; } Now! where do I plant the resize method within the code. I've tried to center these layers by surrounding with a table and centering through the "center" tag but the layers always snap back to the left. Any suggestions would be great. Thanks In Advance. Nino

    N 1 Reply Last reply
    0
    • N Nino_1

      Hi All, I'm attempting to center three div layers within a tabbed view, I'm using a function that was written by a co-worker which is great but I cannot find out were to callout the "resize" within the code. Here is what I have for the function: function centerDivs(){ widthOfDiv = '720'; //put the div width into variable centeringTheDiv = (screen.width) ? (screen.width-widthOfDiv)/2 : 0; //find out where the middle is widthwise //do this for each div layer document.all["LayerOne"].left = centeringTheDiv; document.all["LayerTwo"].left = centeringTheDiv; document.all["LayerThree"].left = centeringTheDiv; } Now! where do I plant the resize method within the code. I've tried to center these layers by surrounding with a table and centering through the "center" tag but the layers always snap back to the left. Any suggestions would be great. Thanks In Advance. Nino

      N Offline
      N Offline
      Nino_1
      wrote on last edited by
      #2

      function centerDivs(){ widthOfDiv = '740'; //put the div width into variable centeringTheDiv = (screen.availWidth) ? (screen.availWidth-widthOfDiv)/2 : 0; //find out where the middle is widthwise //do this for each div layer secondlayer.style.left= centeringTheDiv + 'px'; firstlayer.style.left = centeringTheDiv + 'px'; thirdlayer.style.left = centeringTheDiv + 'px'; firstlayer.style.visibility = "visible"; } function reDo(){ window.location.reload() } window.onresize = reDo; Nino

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups