简体   繁体   中英

Adjusting Div position

I have a icon with onmouseover event handler.

On mouseover it displays a table. the Icon is at the right site of the screen. If the table is small, it will be displayed within visible area. But if the the table is wide enough then only a part of the table is visible. One have to scroll to right to see the rest of the table.

What would be the solution to display it. I mean if the table will go 200px out of the visible area, then it should moved 200px to left.

The table is displayed within an absolutlty positioned DIV.

The div.left + div.clientWidth should be less than document.body.clientWidth. In other words, the furthest to the right (max value of div.left) on the screen your div can be can be calculated as:

document.body.clientWidth - div.clientWidth

Give or take a pixel or two.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM