get minus the offset of current image
I'm working with a slider and the div is scrolling so its offset is having
negative value as it scrolls so I wanted to call a function when the
current image is hidden that is offset of the image is minus the current
image width so I tried the following but no luck to work....
$(window).load(function(){
var $curli = $('#navs .activenav');
var $curliclass = $curli.attr('class').split(' ')[0];
var $curlivalue = parseInt($curliclass.match(/\d+/), 10);
var $curimg = $('#banner').find('.img'+$curlivalue);
if($curimg.offset().left === -$curimg.width()){
alert('hi');
}
});
No comments:
Post a Comment