admin管理员组文章数量:1277404
I was using this code:
/
And it worked fine with jQuery 1.8.3.
Now I changed to jQuery 1.9.1 and it stopped working
Most of my other codes had problems, mostly I had to change .live for .on and it was solved (I don’t know if this was the right thing to do), but with this code, I don’t find the issue.
THIS LINE SEEMS TO GIVE THE PROBLEM:
// IE6 Fix
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
You can test it in jsFiddle and you can change to jQuery 1.8.3, to see how it works.
/
I was using this code:
http://labs.abeautifulsite/archived/jquery-alerts/demo/
And it worked fine with jQuery 1.8.3.
Now I changed to jQuery 1.9.1 and it stopped working
Most of my other codes had problems, mostly I had to change .live for .on and it was solved (I don’t know if this was the right thing to do), but with this code, I don’t find the issue.
THIS LINE SEEMS TO GIVE THE PROBLEM:
// IE6 Fix
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
You can test it in jsFiddle and you can change to jQuery 1.8.3, to see how it works.
http://jsfiddle/sebababi/P8sfn/1/
Share Improve this question edited Apr 12, 2013 at 17:22 j08691 208k32 gold badges269 silver badges280 bronze badges asked Apr 12, 2013 at 14:32 SebastianSebastian 4852 gold badges8 silver badges22 bronze badges 1- 2 Please research when you upgrade. jquery./upgrade-guide/1.9 – Ian Commented Apr 12, 2013 at 14:34
4 Answers
Reset to default 6$.browser
was deprecated in jQuery 1.3 and removed in 1.9.
http://jquery./upgrade-guide/1.9/#jquery-browser-removed
You should use the jQuery migrate plugin to see any errors when migrating to 1.9x. Also, jQuery remends using feature detection with a library such as Modernizr.
You can use the jQuery Migrate plugin and call the $.browser
. It will work!
Using the plugin is easy; just include it immediately after the script tag for jQuery, for example.
<script src="http://code.jquery./jquery-1.9.1.js"></script>
<script src="http://code.jquery./jquery-migrate-1.1.1.js"></script>
JS:
$.each($.browser, function(i, val) {
$("<div>" + i + " : <span>" + val + "</span>")
.appendTo( document.body );
});
DEMO HERE (See Migrate 1.1.0 check box is checked on left side)
$.browser has been removed from 1.9. You can use jQuery Migrate to have $.browser support.
See previously: TypeError: 'undefined' is not an object (evaluating '$.browser.msie')
Use feature detection.
var someEl = $("#theid");
someEl.css("position","fixed");
if ( someEl.css("position") == "static" ) {
// doesn't support fixed, use absolute
someEl.css("position","absolute");
}
(not tested)
本文标签:
版权声明:本文标题:javascript - jQuery migration from 1.8.3 to 1.9.1 stops working in one line, and I don't know why - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741288634a2370418.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论