0

Well I have this: http://codepen.io/seraphzz/pen/HfqBy

OK, I've used animate(); before and it has worked perfectly. I just don't know why it doesn't this time.(It's a long image that I want to move on hover)

Also, I'm trying to make it responsive using percentages but It won't get any height if I don't use pixels.

Can you guys help me with that? Thanks in advance! Best regards!

  • Thanks Stano!, that works perfectly. This is the attempt to make it responsive: http://jsfiddle.net/W6hCp/1/ I tried making body and html 100% width and height but still nothing – Massimo Valerio May 31 '13 at 23:54
  • I did the same here, and it works, I'm not sure why though lol. It's still in progress: http://mvalerio85.herzingwebdesign.com/port/ – Massimo Valerio Jun 01 '13 at 00:44
  • Thanks for taking the time to solve it Stano. I had tried that jquery solution before but it's not 100% responsive. I mean it resizes the box when the page loads, but if you resize it the height stays the same. In the page I posted I think it's working because the image is perfectly square. – Massimo Valerio Jun 01 '13 at 16:24
  • That was perfect!. Stano, again, thanks a lot. – Massimo Valerio Jun 01 '13 at 17:17

1 Answers1

1

I had success by adjusting the way you are selecting elements.

Instead of using children() like this:

$(this).children('.frame img')

Try this, selecting .frame img within this.

$('.frame img',this)

http://codepen.io/seraphzz/pen/pfHLg

showdev
  • 28,454
  • 37
  • 55
  • 73
  • Wow, thanks a lot. I'm still learning this...I hope to get there eventually lol. – Massimo Valerio May 31 '13 at 23:51
  • No problem. Yes, it takes some practice. I use this documentation quite a bit for help with tree-traversal: http://api.jquery.com/category/traversing/tree-traversal/ – showdev Jun 03 '13 at 18:40