views:

34

answers:

1

Well i have a scrolling plugin that i'm using to move divs when i click nav anchors. There are two different settings, which i already didn't want to happen, but i had too since i didn't know a way around this:

Look:

var jump=function(e)
{
//the plugin code...
  scrollTop: $(target).offset().top - 110
}

and another one with a different offset subtract number

var jump=function(e)
{
//the plugin code...
  scrollTop: $(target).offset().top - 315
}

Than i call them by using this :

$('li.sidebarLi a').bind("click", jump2);
$('li.yearsLi a').bind("click", jump);
return false;

What happened with ie7 is that it, for some freaking reason beyond imagination the final position is totally different. So i had to create an if on html for ie7 and call those functions again with different values (for both 110, and 315).

So the end result for ie7 users, is 2 useless function calling and 2 usefull. What i wanted was to have an way to do that without calling all that again, maybe a dynamic way to change that value if ie7. And if someone knew a way to do this without 2 functions, better, it would have to have to check to see if its sidebar or years nav and than set the value to scroll.

Hope someone can help me out with this one. Cheers.

A: 

Try:

scrollTop: $(target).offset().top - ($.browser.msie && parseInt($.browser.version)==7? 315: 110)

That said, it's unlikely that this issue is due to IE7 alone - I'd suggest trying to treat the underlying symptom than to superficially throw conditionals about

K Prime