PDA

View Full Version : Fixed problem not solved :(



winpeace
11-03-2007, 08:09 PM
I use this code;

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>

<style type="text/css">

#dynstuff {
position:fixed;
}

</style>
</head>
<script language="JavaScript1.2">

//Random iframe content- Dynamic Drive (www.dynamicdrive.com)
//For full source code, and Terms Of use, visit http://dynamicdrive.com
//This credit MUST stay intact for use

var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1

//Specify IFRAME display attributes
var iframeprops='width=260 height=260 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"'

//Specify random URLs to display inside iframe
var randomcontent=new Array()
randomcontent[0]="/ab.html"
randomcontent[1]="random2.htm"
randomcontent[2]="random3.htm"
randomcontent[3]="random4.htm"


//No need to edit after here
if (ie||dom)
document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')

function random_iframe(){
if (ie||dom){
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)]

}
}

window.onload=random_iframe

</script>

ie7 and mozilla fixed ok
but ie6 not fixed.
can anyone help

jscheuer1
11-03-2007, 09:37 PM
IE 6 doesn't do:

position:fixed;

Sometimes, position:absolute; or relative; or just not positioning the item (which is the default and that is done as - position:static; - if it needs to be specified) for IE 6 - though definitely different and different looking than position:fixed; will be acceptable in IE 6. Otherwise, you need to use javascript and/or some kind of style gymnastics to simulate the fixed position value in IE 6.

winpeace
11-04-2007, 07:31 AM
Otherwise, you need to use javascript and/or some kind of style gymnastics to simulate the fixed position value in IE 6.

How?Can you help me?My english is bad sorry.

jscheuer1
11-04-2007, 08:47 AM
Working from your example page, there is no difference between position:absolute; and position:fixed;, because there would be no scrolling. So I'm not sure what to tell you. You can do this:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>

<style type="text/css">

#dynstuff {
position:fixed;
}

</style>
<!--[if IE 6]>
<style type="text/css">
#dynstuff {
position:absolute;
top:expression(get_ie_top());
left:expression(get_ie_left());
}
</style>
<![endif]-->
</head>
<script language="JavaScript1.2">

function get_ie_top(){
return document.body.scrollTop+14+'px';
}
function get_ie_left(){
return document.body.scrollLeft+10+'px';
}

//Random iframe content- Dynamic Drive (www.dynamicdrive.com)
//For full source code, and Te . . .

But if you change your DOCTYPE to one with a valid URL, the functions would need to use document.documentElement instead of document.body.

winpeace
11-04-2007, 08:55 AM
thank you it is ok but;
it is like floating not fixed;why?
ı want to likes ff and ie7 is wonderful

jscheuer1
11-04-2007, 09:25 AM
Well, IE 6 doesn't do fixed. Here is an all style approach, but it can get messed up if the page needs a horizontal scrollbar, and requires a valid URL DOCTYPE:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>

<style type="text/css">

#dynstuff {
position:fixed;
}

</style>
<!--[if IE 6]>
<style type="text/css">
html, body {
height: 100%;
margin: 0;
padding: 0;
}

html {
overflow: hidden;
}
body {
overflow: auto;
}

/* to actually be fixed, this element's stacking
context must be relative to the root element. */

#dynstuff {
position: absolute;
top: 16px;
left:10px
}
</style>
<![endif]-->
</head>
<script language="JavaScript1.2">

//Random iframe content- Dynamic Drive (www.dynamicdrive.com)
//For full source c . . .

winpeace
11-04-2007, 11:50 AM
problem is going on :(

I want like this;but this codes not solved my problem

http://www.url.com/search/result?google=3&yhoo=1&url=http%3A%2F%2Fhome.tampabay.rr.com%2Fbmerkey%2Fexamples%2Ffake-position-fixed.html&title=Position%3AFixed%20in%20IE6&q=109843

winpeace
11-04-2007, 01:09 PM
//Specify IFRAME display attributes
var iframeprops='width=260 height=260 marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="1" scrolling="no"'

when I change height=>620
I add this code and your codes;

#dynstuff {
position: absolute;
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
}


but scrollbar without end don't stop(your codes too problem)

jscheuer1
11-04-2007, 02:19 PM
Are you using a strict DOCTYPE with valid URL?

Please post a link to the page on your site that contains the problematic code so we can check it out.

winpeace
11-04-2007, 02:40 PM
I use this code only;

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

jscheuer1
11-04-2007, 03:07 PM
Please post a link to the page on your site that contains the problematic code so we can check it out.

winpeace
11-04-2007, 03:14 PM
only problem ie6
link: www.haberpc.com

winpeace
11-05-2007, 11:18 AM
can you see problem?

please your screen is 1024*768
and use ie6

when you pull scrollbar it is not stop

jscheuer1
11-05-2007, 03:33 PM
can you see problem?

please your screen is 1024*768
and use ie6

when you pull scrollbar it is not stop

I cannot replicate the problem here or even see it on your page. Your source code is very messy and invalid. Either start over and make a valid, clean page, or go back to the first solution, which worked but of which you said:


thank you it is ok but;
it is like floating

winpeace
11-05-2007, 03:45 PM
you can see it now. 1024*768 screen regulating and ie6

(I play codes always because my problem not solved) :(

jscheuer1
11-05-2007, 04:17 PM
Change:


<!--[if IE 6]>
<style type="text/css">
#dynstuff {
position:absolute;
width=260px;
height=626px;
top:expression(get_ie_top());
left:expression(get_ie_left());
}
</style>
<![endif]-->

to:


<!--[if IE 6]>
<style type="text/css">
#dynstuff {
position:absolute;
width:260px;
height:expression(document.body.clientHeight+'px');
top:expression(get_ie_top());
left:expression(get_ie_left());
}
</style>
<![endif]-->

molendijk
11-05-2007, 05:28 PM
Hello,
You can do this (doctype independent):
position:absolute;top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop+screen.height*number : document.body.scrollTop+screen.height*number)

to have the position fixed in <=IE6 (but it seems that John already did that). Of course, you have to fill in something for 'number'.

To avoid the float, put something like this for the body:
body{background:url(foo) fixed;}

Arie Molendijk

winpeace
11-05-2007, 06:26 PM
thank you very very much john :)