前端之家收集整理的这篇文章主要介绍了
10个很棒的jQuery代码片段,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_301_0@
<div class="jb51code">
<pre class="brush:js;">
(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");
max_height) { max_height = $(this).height(); }
});
$("div.col").height(max_height);
return function(prop) {
if ( prop in div.style ) return true;
prop = prop.replace(/^[a-z]/,function(val) {
return val.toUpperCase();
});
while(len--) {
if ( vendors[len] + prop in div.style ) {
// browser supports box-shadow. Do what you need.
// Or use a bang (!) to test if the browser doesn't.
return true;
}
}
return false;
};
})();
if ( supports('textShadow') ) {
document.documentElement.className += ' textShadow';