на всякий случай, если кто-то заинтересован в этом варианте ...
я хотел, чтобы сама ссылка была отделена от анимированного изображения , я немного повозился с кодом, и теперь у меня это работает.
JavaScript / JQuery:
print(" $(function()
{
$('#myLink').click( function(ev){
//prevent the default action of the event, this will stop the href in the anchor being followed
//before the animation has started, u can also use return false;
ev.preventDefault();
//store a referene to the anchor tag
var $self=$('img#myImage');
var $link=$('a#myLink');
//get the image and animate
($self).animate( {height:"10px"}, function(){
//now get the anchor href and redirect the browser
document.location = $link.attr('href');
});
});
});
");
разметка:
print("<body>
<a id="myLink" href="http://www.google.co.uk">LINK</a>
<img id="myImage" src="http://www.derekallard.com/img/post_resources/jquery_ui_cap.png"/>
</body>");
, который сказал, я, вероятно, уродлив код. поэтому мои извинения там.