Animate div and child paragraph
Hi,
I'm new to the forum and to jQuery. I couldn't find the solution to this problem on my own, I think the solution has something to do with selectors.
I animated successfully a div's border on the hover event, but would also like the child paragraph to perform an animation but with the following code I cannot isolate only the paragraph belonging to the div that's being hovered, and all paragraphs child to a div also animate.
I cannot use the this keyword here, so I'm stuck.
- var jq=jQuery.noConflict();
- jq(document).ready(function()
- {
- jq("#container div").hover(function()
- {
- jq(this).stop(true,true).animate({
- width:'-=20',
- height: '-=20',
- borderLeftWidth: '+=10',
- borderTopWidth: '+=10',
- borderRightWidth: '+=10',
- borderBottomWidth: '+=10'}, 300);
- },
- function(){jq(this).stop(true,true).animate({
- width: '+=20',
- height: '+=20',
- borderLeftWidth: '-=10',
- borderTopWidth: '-=10',
- borderRightWidth: '-=10',
- borderBottomWidth: '-=10'}, 600);});
-
- jq("#container div").hover(function()
- {
- jq(this).find('#container p').stop(true,true).animate({
- marginTop:'-=5'}, 300);
- },
- function(){jq(this).find('#container p').stop(true,true).animate({
- marginTop:'+=5'}, 600)});
- });