开发者

IE not recognizing jQuery selector

开发者 https://www.devze.com 2023-01-07 11:40 出处:网络
Here\'s the snippet of code that I\'m using to animate a div with jQuery: $(\'.row0\').hover(function(){

Here's the snippet of code that I'm using to animate a div with jQuery:

        $('.row0').hover(function(){
     var markeranim = $('.marker0');
     var shadowanim = $('.markerShadow0')
     var markertop = markeranim.position().top;
     var shadowtop = shadowanim.position().top;
     var shadowleft = shadowanim.position().left;
      $('tr.row0').addClass('rowHoveredEven');
       markeranim.animate({ top: [markertop - 20 + 'px'] }, 250, 'linear',
function() {
                    markeranim.animate({ top: [markertop + 'px'] }, 250, 'linear',
function() {
                        markeranim.animate({ top: [markertop - 10 + 'px'] }, 200,
'linear', function(开发者_Python百科) {
                            markeranim.animate({ top: [markertop + 'px'] }, 200);
                        });
                    });
                });//close animation

This works great in all browsers but IE (of course). IE gives an error saying that: "'position().top' is null or not an object" along with: "'position().left' is null or not an object". Anyone know why or another way that I could grab these attributes that IE would play nice with?


The .position() dimensions plugin has been deprecated as of 1.2.6, use .css() instead:

var myTop = markeranim.css("top");
var myLeft = markeranim.css("left");

http://docs.jquery.com/Plugins/dimensions

0

精彩评论

暂无评论...
验证码 换一张
取 消