Solution to fixed failure in IE6, ie6fixed failure
After searching online for a long time, I finally found an effective solution for the test.
<! -- [If IE 6]> <script type = "text/javascript"> (function ($) {jQuery. fn. fixed = function (options) {var defaults = {x: 0, y: 0}; var o = jQuery. extend (defaults, options); var isIe6 =! Window. XMLHttpRequest; var html =$ ('html'); if (isIe6 & html.css ('backgroundachment ')! = 'Fixed') {// prevents jitter html.css ('backgroundachment', 'fixed '). css ('backgroundage', 'url (about: blank) ');}; return this. each (function () {var domThis = $ (this) [0]; var objThis = $ (this); if (isIe6) {objThis.css ('position ', 'abort'); domThis. style. setExpression ('left', 'eval(document.doc umentElement ). scrollLeft + '+ o. x + ') + "px"'); domThis. style. setExpression ('top', 'eval(document.doc umentElem Ent ). scrollTop + '+ o. y + ') + "px"');} else {objThis.css ('position', 'fixed').css('top', o.y).css ('left', o. x) ;}};};}) (jQuery) </script> <! [Endif] -->
The call method is as follows:
<!--[if IE 6]><script type="text/javascript">$(function(){$('.float').Fixed({x:800,y:200});});</script><![endif]-->
Fixed is usually used in two scenarios.
1. Centered bullet layer:
<! -- [If IE 6]> <script type = "text/javascript"> $ (function () {// centerX and centerY are the height and width of the visible window, to center var screenheight?document.doc umentElement, you must subtract half of the width or height. clientHeight, screenwidth?document.doc umentElement. clientWidth, floatHeight = $ ('. float '). height (), floatWidth = $ ('. float '). width (); $ ('. float '). fixed ({x :( screenWidth-floatWidth)/2, y :( screenHeight-floatHeight)/2}) ;}</script> <! [Endif] -->
2. The bounce layer on the right is similar to the back-to-top layer:
<! -- [If IE 6]> <script type = "text/javascript"> $ (function () {// centerX and centerY are the height, width, and height of the visible window, width: screen width-float Layer Width var screenheight?document.doc umentElement. clientHeight, screenwidth?document.doc umentElement. clientWidth, floatHeight = $ ('. float '). height (), floatWidth = $ ('. float '). width (); $ ('. float '). fixed ({x: screenWidth-floatWidth, y: 300}) ;}); </script> <! [Endif] -->
That's all right.
Position: fixed Bug in IE6 and flash
. Gotop {
Width: 20px;
Float: right;
Position: fixed;
_ Position: absolute;
_ Top: expression (documentElement. scrollTop + documentElement. clientHeight-this.offsetHeight );
Top: 620px;
Right: 160px;
Background: none;
}
Ie6 is not supported. You can use the following code for hack:
_ Position: absolute;
_ Top: expression (documentElement. scrollTop + documentElement. clientHeight-this.offsetHeight );
In ie6, a: link is invalid and the effect is the same as that of a: visited. Solution
This pseudo class of a is incompatible in ie6. It is best to write it in js. You can use a class name. When onmousedown is used, the class name is obtained and onmouseout is removed when it leaves, at the same time, the order of the four pseudo classes of a is l v a h, that is, link, visited, active, hover