最近在做一个类似于幻灯片的网页电子简历,主要使用的是jQuery的animate函数,碰到了一个坑,跳坑花了两小时。
jQuery对象才能使用它的函数,如果用选择器同时选中2个元素的话,animate函数的回调函数会执行2次,开始还以为是逻辑错误,判断了半天。后来静下心排错,终于发现了这个坑。