Forum Moderators: not2easy
- a container div (black)
- a background image (white)
- two images imposed on the background image (red and blue)
- some text relating to the blue image.
The expected behavior is how this works in FF/chrome/safari, etc. All wrapped components move with each other when the scrollable div is scrolled.
The issue is that on IE6/7 (and I have some reports of the issue on IE8 too, though I can't reproduce) the red and blue boxes along with the text stay fixed on the screen while the container and background images move.
Any help would be appreciated.
Thanks,
Keith
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><style>
div#attachment-nav div {
display:inline;
color: #444444;
background: #eeeeee;
padding:3px;
padding-right:5px;
padding-left:5px;
border: 1px solid #999999;
text-decoration:none;
font-weight: bold;
float: left;
margin-right: 5px;
margin-bottom: 1px;
}
div#attachment-nav div a:hover {
text-decoration: underline;
}
div#attachment-nav div.active-nav {
background:#bbbbbb;
color:#ffffff;
}
#sorting-container {
padding:10px;
overflow: auto;
width:930px;
//height:420px; - allow window to stretch in height to avoid icon positioning issues in IE
border:1px solid #666666;
}
#sorting-container > div {
float: left;
margin: 4px;
padding: 4px;
border: 1px solid #ccc;
}
#sorting-container div[state="U"] {
}
#sorting-container div[state="V"] {
background: #005826;
}
#sorting-container div[state="R"] {
background: #9e0b0f;
}
#sorting-container div[state="N"] {
background: #f26522;
}
#sorting-container div[state="M"] {
background: #000000;
}
.doc_list_active {
border: 1px solid #FF0000 !important;
}
#preview_div {
display:inline;
float:left;
}
#tools_div {
display:inline;
float:left;
}
.subtool_div {
position:absolute;
background-color:white;
border:1px solid #666666;
padding:2px;
}
</style>
</head>
<body>
<div id="sorting-container">
<div id="preview_1" state="V">
<div style="position:relative;" z-index="99999">
<div style="position:absolute;">
<div id="preview_div">
<div style="width: 20px; height: 20px; background-color: red;">
</div>
</div>
<div id="tools_div">
<div style="width: 20px; height: 20px; background-color: blue;">
</div>
<div class="subtool_div" id="subtool_div_1">
<a href="#" >Rotate 180</a>
<br>
<a href="#" >Rotate 90</a>
<br>
<a href="#" >Rotate 270</a>
</div>
</div>
</div>
</div>
<div style="cursor:pointer" onClick="select_page(1);return false;">
<div style="width: 300px; height: 300px; background-color: white;">
</div>
</div>
</div>
<div id="preview_1" state="V">
<div style="position:relative;" z-index="99999">
<div style="position:absolute;">
<div id="preview_div">
<div style="width: 20px; height: 20px; background-color: red;">
</div>
</div>
<div id="tools_div">
<div style="width: 20px; height: 20px; background-color: blue;">
</div>
<div class="subtool_div" id="subtool_div_1">
<a href="#" >Rotate 180</a>
<br>
<a href="#" >Rotate 90</a>
<br>
<a href="#" >Rotate 270</a>
</div>
</div>
</div>
</div>
<div style="cursor:pointer" onClick="select_page(1);return false;">
<div style="width: 300px; height: 300px; background-color: white;">
</div>
</div>
</div>
<div id="preview_1" state="V">
<div style="position:relative;" z-index="99999">
<div style="position:absolute;">
<div id="preview_div">
<div style="width: 20px; height: 20px; background-color: red;">
</div>
</div>
<div id="tools_div">
<div style="width: 20px; height: 20px; background-color: blue;">
</div>
<div class="subtool_div" id="subtool_div_1">
<a href="#" >Rotate 180</a>
<br>
<a href="#" >Rotate 90</a>
<br>
<a href="#" >Rotate 270</a>
</div>
</div>
</div>
</div>
<div style="cursor:pointer" onClick="select_page(1);return false;">
<div style="width: 300px; height: 300px; background-color: white;">
</div>
</div>
</div>
<div id="preview_1" state="V">
<div style="position:relative;" z-index="99999">
<div style="position:absolute;">
<div id="preview_div">
<div style="width: 20px; height: 20px; background-color: red;">
</div>
</div>
<div id="tools_div">
<div style="width: 20px; height: 20px; background-color: blue;">
</div>
<div class="subtool_div" id="subtool_div_1">
<a href="#" >Rotate 180</a>
<br>
<a href="#" >Rotate 90</a>
<br>
<a href="#" >Rotate 270</a>
</div>
</div>
</div>
</div>
<div style="cursor:pointer" onClick="select_page(1);return false;">
<div style="width: 300px; height: 300px; background-color: white;">
</div>
</div>
</div>
<div id="preview_1" state="V">
<div style="position:relative;" z-index="99999">
<div style="position:absolute;">
<div id="preview_div">
<div style="width: 20px; height: 20px; background-color: red;">
</div>
</div>
<div id="tools_div">
<div style="width: 20px; height: 20px; background-color: blue;">
</div>
<div class="subtool_div" id="subtool_div_1">
<a href="#" >Rotate 180</a>
<br>
<a href="#" >Rotate 90</a>
<br>
<a href="#" >Rotate 270</a>
</div>
</div>
</div>
</div>
<div style="cursor:pointer" onClick="select_page(1);return false;">
<div style="width: 300px; height: 300px; background-color: white;">
</div>
</div>
</div>
</div>
</body>
</html>
1) //height:420px; - allow window to stretch in height to avoid icon positioning
The two slashes should be removed from the CSS and the comment should be enclosed /*Comment"/
W3C - Comments [w3.org]
2) An id can only be used once per page, but id="preview_1" and #preview_div are each used five times in the sample.
W3C - Element identifiers [w3.org].
id = name [CS]
This attribute assigns a name to an element. This name must be unique in a document.
A class should be used instead. I would recommend validating the HTML and CSS before hunting down the problem.
3) There is a large proportion of inline CSS. I would reconsider the HTML and/or CSS structure. There is more presentation in the HTMl than structure.
4) There is no CSS declaration for #preview_1. Should there be?
<div style="position:relative;" z-index="99999">
Correct is:
<div style="position: relative; z-index: 99999;">
I would still take a very hard look at the large amount of presentation markup in the HTML. The need for z-index; is unclear.
Needs a lot of clean up before being worth looking at any further.
I also tested with and without z-index - still no change, so I left z-index out this time.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><style>
#sorting-container {
padding:10px;
overflow: auto;
width:930px;
height:420px;
border:1px solid #666666;
}
#sorting-container > div {
float: left;
margin: 4px;
padding: 4px;
border: 1px solid #ccc;
background-color: black;
}
</style>
</head>
<body>
<div id="sorting-container">
<!-- The following block of code just repeats to illustrated the scroll issue -->
<div >
<div style="position: relative; ">
<div style="position: absolute;">
<div id="preview_div">
<div style="width: 20px; height: 20px; background-color: red;">
</div>
</div>
</div>
</div>
<div>
<div style="width: 300px; height: 300px; background-color: white;">
</div>
</div>
</div>
<!-- The following block of code just repeats to illustrated the scroll issue -->
<div >
<div style="position: relative; ">
<div style="position: absolute;">
<div id="preview_div">
<div style="width: 20px; height: 20px; background-color: red;">
</div>
</div>
</div>
</div>
<div>
<div style="width: 300px; height: 300px; background-color: white;">
</div>
</div>
</div>
<!-- The following block of code just repeats to illustrated the scroll issue -->
<div >
<div style="position: relative; ">
<div style="position: absolute;">
<div id="preview_div">
<div style="width: 20px; height: 20px; background-color: red;">
</div>
</div>
</div>
</div>
<div>
<div style="width: 300px; height: 300px; background-color: white;">
</div>
</div>
</div>
<!-- The following block of code just repeats to illustrated the scroll issue -->
<div >
<div style="position: relative; ">
<div style="position: absolute;">
<div id="preview_div">
<div style="width: 20px; height: 20px; background-color: red;">
</div>
</div>
</div>
</div>
<div>
<div style="width: 300px; height: 300px; background-color: white;">
</div>
</div>
</div>
</div>
</body>
</html>
[webmasterworld.com...]