【发布时间】:2012-10-18 13:44:14
【问题描述】:
当我点击任何年份列(2012、2011、2010 等)时,它会显示每年的内容并隐藏其他年份。
问题在于,当我点击时(例如 2011 年专栏),动画同时完成所有效果,让用户感到困惑,我想我必须用动画步骤来做,但我一直没能做到来个jquery解决方案吧。
这是我的代码:
/* Scroll Function */
function scrollto(position){
$('html, body').stop().animate({
scrollLeft: position
}, 1000);
}
/* Calendar Scroll */
$(".sub_section_title").click( function(e) {
e.preventDefault();
$(".contenido_calendario").hide();
$(this).next(".contenido_calendario").toggle('slow');
scrollto($(this).offset().left - 352)
});
我尝试过使用.queue()修复效果,但是不行,不知道代码写得好不好:
$(".sub_section_title").click( function(e) {
e.preventDefault();
$(".contenido_calendario").hide();
$(".contenido_calendario").queue(function() {
scrollto($(this).offset().left - 352);
$(this).dequeue();
});
$(".contenido_calendario").queue(function() {
$(this).next(".contenido_calendario").toggle('slow')
$(this).dequeue();
});
});
动画应该是: 点击 2011 > 向左滚动 2011 列(隐藏 2012 内容) > 显示内容动画
【问题讨论】:
标签: javascript jquery html css ajax