[英]On click do some action and then load page
I'm looking for a script which does the following: 我正在寻找执行以下操作的脚本:
I have a banner with height 200px, below that banner I have a couple of links. 我有一面横幅,高度为200像素,在该横幅下方,我有几个链接。 When I click on one of the link (let say with class="link-one") then first let the banner animate to 0px height, then ajax load the new page with banner height 0 and then animate to 200px height.
当我单击其中一个链接时(请使用class =“ link-one”进行说说),然后首先使横幅动画化为0px高度,然后用ajax加载横幅高度为0的新页面,然后动画化为200px高度。
Maybe it's a bit hard to use ajax and I can keep that part out, so befor loading the new page do the animation and when loaded the new page do the animation. 也许使用ajax有点困难,我可以保留这一部分,所以在加载新页面之前执行动画,而在加载新页面之前执行动画。
//example from flicker, can be any ajax call
var flickerAPI = "http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?";
$("#banner").click(function() {
$(this).animate({height:"toggle"},5000,function() { //height:toggle changes the height to 0, the bak to the original height
$.getJSON( flickerAPI, {
tags: "mount rainier",
tagmode: "any",
format: "json"
}).done(function( data ) {
$("#banner").animate({height:"toggle"},5000,function() {
alert("done")
});
});
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.