推荐10 个很棒的 jQuery 特效代码

推荐10 个很棒的 jQuery 特效代码

1.图片预加载

(function($) {
var cache = [];
// Arguments are image paths relative to the current page.
$.preLoadImages = function() {
var args_len = arguments.length;
for (var i = args_len; i–;) {
var cacheImage = document.createElement(img);
cacheImage.src = arguments[i];
cache.push(cacheImage);
}
}

jQuery.preLoadImages(“image1.gif”, “/path/to/image2.png”);

2. 在新窗口打开链接 (target=”blank”)

$(a[@rel$=external]).click(function(){
this.target = “_blank”;
});

/*
Usage:

© 版权声明

相关文章

暂无评论

none
暂无评论...