I have the following code :
<script type="text/javascript">
function shownavall()
{
$('#shownavall').slideToggle('slow', function() {
$('.otherlink').toggle(function(){
$(this).css('background-position', '0px 0px');
}, function(){
$(this).css('background-position', '25px 0px');
});
});
}
</script>
when I try to call the function the function works on the slidetoggle part. but does not change the css for .otherlink I want to know why? and how to fix it?
I tried to do it by using a conditioning statement, here is my code : (this code does not work at all!)
function shownavall()
{
$('#shownavall').slideToggle('slow', function() {
if ($('.otherlink').css('background-position') == '25px 0px')
{
$(.otherlink).css('background-position', '0px 0px');
}
else
{
$(.otherlink).css('background-position', '25px 0px');
}
});
}
I am 100% sure that the mistake is in my Jquery code. so please do not ask about the html or the css.
1 Answer