Reputation: 10046
I have a problem with jQuery, my code looks ok, but I'm getting an error, which sounds like this:
missing ; before statement [Break on this error] }elseif($('.v_gallery li:first').hasClass('s')){\n
And my code looks like this:
_gallery_pag : function() {
$('#top_pag a').live('click',function() { var _type = $(this).attr('rel');switch(_type) { case '1': if($('.v_gallery li:last').hasClass('s')) { $('.v_gallery li:first').find('a').click(); }elseif($('.v_gallery li:first').hasClass('s')){ alert('You can\'t go back!You are at the first page!'); } break; } return false; }); }
I know, probably I miss spell checked something...because I don't see any problems.
10x guys
Upvotes: 0
Views: 3826
Reputation: 26713
you wrote elseif instead of "else if" - in javascript, those are two different keywords.
here is your fixed code:
_gallery_pag : function() {
$('#top_pag a').live('click',function() { var _type = $(this).attr('rel');
switch(_type)
{
case '1':
if($('.v_gallery li:last').hasClass('s'))
{
$('.v_gallery li:first').find('a').click();
}else if($('.v_gallery li:first').hasClass('s')){
alert('You can\'t go back!You are at the first page!');
}
break;
}
return false;
});
}
Upvotes: 2