我正在使用jQuery制作一个徽标滑块。我的第一个想法是使用一个大的单一图像组成的所有标志作为背景,并动画其位置。这背后的想法是通过只加载一个文件来减少http请求。
jQuery代码如下所示:
<script>
$(function(){
var current = 0;
function bgscroll(){
// 20 pixel row at a time
current -= 20;
// move the background with backgrond-position css properties
在jQuery中进行动画时,只有当所有元素都完成动画而不是每个元素都完成动画时才触发回调,那么最佳实践是什么?
例如:
$('.someElements').fadeOut('fast', function() {
// dont do this until ALL elements are done fading
}
load.js:
jQuery(document).ready(function($) {
$('.dialog ul li').click(function(e) {
switch($(this).attr('id')) {
case 'addProject':
$('.addDialog').load('/add/addprojectform');
break;
case 'addTask':