0
我使用jquery.address()通过Ajax加载我的网页:jQuery的地址找到点击了哪个元素
$ .address.state( '')的init(函数(){
// Initializes the plugin
$('#menu a').address();
$('#nextprev a').address();
}).change(function(event) {
// Loads the page content and inserts it into the content area
$.ajax({
url: $.address.state() + event.path,
error: function(XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest.responseText);
},
success: function(data, textStatus, XMLHttpRequest) {
$('title').html($('title', data).html());
$.address.title(/>([^<]*)<\/title/.exec(data)[1]);
$('#content').html($('#content', data).html());
loadstuff();
startAnimation();
}
});
var startAnimation = function(data) {
... some animation going on here
});
代码调用Ajax来加载下一页目前后,下一个页面通过startAnimation()。这工作真的没事至今苍蝇。
但是我有一个#next和#nextprev内的#prev元素。我想要找到他们哪个被点击,然后加载一个不同的函数(即startAnimation2())。
酷是类似的东西。我也已经考虑过cookies,但是我想为#next和#prev有两种不同的动画类型。我如何知道哪些是实际点击?该标记只会提供一种动画类型.... – Mike
已编辑帖子。你可以做它,因为它显示或使用多个输入元素。 – yoda
嗯好吧,我会尝试。谢谢尤达! – Mike