- This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
Viewing 11 posts - 1 through 11 (of 11 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › can someone tell me what i’ve done wrong with this following code
Hi all, this jQuery code i wrote isn’t working, its telling me there is a syntax error on the line with “$(this).animate({” but I don’t see it.
$(document).ready(function(){
$("#navigation li a").hover({
$(this).animate({
border-bottom-left-radius: '0',
border-top-right-radius: '0',
border-top-left-radius: '20px',
border-bottom-right-radius: '20px',
}, 5000);
});
});
$(document).ready(function(){
$("#navigation li a").hover(function() {
$(this).animate({"border-radius":"20px 0"}, 5000);
});
});
5000 seems like a long time for a hover effect.
sadly that doesn’t work either :(
yes it does, are you loading jqeury? The 5000 puts a 5 second delay on the effect.
yes i’m loading jquery, the console keeps telling me theres a syntax error
then its in some other part of your script, console.log in firebug to troubleshoot it i guess.
I copied and pasted my entire script onto this thread, so what you see is my entire script.
This is my test doc and its working here.
js border radius
In your script I don’t think you should have that last comma after the bottom-right radius line
I should note that the .hover() is made to control both the MouseOver and MouseLeave events. If you’re only using it for a MouseOver i suggest using .mouseover()
$().hover(
function(){
// on mouse over code
},
function(){
// on mouse leave code
});
Thanks all,
I got it working in the end
@josh, i was planning to add a mouse out event also i just kept it simple to start with to weed out any issues.
Thanks again all.