Reputation: 485
I was using this code:
http://labs.abeautifulsite.net/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.net/sebababi/P8sfn/1/
Upvotes: 3
Views: 4741
Reputation: 95027
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)
Upvotes: 0
Reputation: 513
$.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')
Upvotes: 0
Reputation: 73896
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.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/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)
Upvotes: 5
Reputation: 207891
$.browser
was deprecated in jQuery 1.3 and removed in 1.9.
http://jquery.com/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 recommends using feature detection with a library such as Modernizr.
Upvotes: 6