01
(
function
($) {
02
var
cache = [];
03
// Arguments are image paths relative to the current page.
04
$.preLoadImages =
() {
05
args_len = arguments.length;
06
for
i = args_len; i--;) {
07
cacheImage = document.createElement(
'img'
);
08
cacheImage.src = arguments[i];
09
cache.push(cacheImage);
10
}
11
12
13
jQuery.preLoadImages(
"image1.gif"
,
"/path/to/image2.png"
1
$(
'a[@rel$='
external
']'
).click(
(){
2
this
.target =
"_blank"
;
3
});
4
5
/*
6
Usage:
7
<a href="http://www.catswhocode.com" rel="external">catswhocode.com</a>
8
*/
/* 该代码只有1行,但是最简单的用来检测浏览器是否支持 JavaScript 的方法,如果支持 JavaScript 就在 body 元素增加一个 hasJS 的 class */
'body'
).addClass(
'hasJS'
$(document).ready(
"a.topLink"
"html, body"
).animate({
scrollTop: $($(
).attr(
"href"
)).offset().top +
"px"
}, {
duration: 500,
easing:
"swing"
return
false
".thumbs img"
).fadeTo(
"slow"
, 0.6);
// This sets the opacity of the thumbs to fade down to 60% when the page loads
).hover(
, 1.0);
// This should set the opacity to 100% on hover
},
// This should set the opacity back to 60% on mouseout
9
max_height = 0;
"div.col"
).each(
if
($(
).height() > max_height) { max_height = $(
).height(); }
).height(max_height);
(!
/*@cc_on!@*/
0)
e =
"abbr,article,aside,audio,bb,canvas,datagrid,datalist,details,dialog,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video"
.split(
','
),i=e.length;
while
(i--){document.createElement(e[i])}
})()
//然后在head中引入该js
<!--[
lt IE 9]>
<script src=
"http://html5shim.googlecode.com/svn/trunk/html5.js"
></script>
<![endif]-->
supports = (
div = document.createElement(
'div'
),
vendors =
'Khtml Ms O Moz Webkit'
' '
len = vendors.length;
(prop) {
( prop
in
div.style )
true
prop = prop.replace(/^[a-z]/,
(val) {
val.toUpperCase();
(len--) {
14
( vendors[len] + prop
div.style ) {
15
// browser supports box-shadow. Do what you need.
16
// Or use a bang (!) to test if the browser doesn't.
17
18
19
20
21
};
22
})();
23
24
( supports(
'textShadow'
) ) {
25
document.documentElement.className +=
' textShadow'
$.urlParam =
(name){
results =
new
RegExp(
'[\\?&]'
+ name +
'=([^&#]*)'
).exec(window.location.href);
(!results) {
0; }
results[1] || 0;
"#form"
).keypress(
(e) {
(e.which == 13) {
posted on 2013-04-16 16:40 Mr.lu 阅读(185) 评论(0) 编辑 收藏
Powered by: BlogJava Copyright © Mr.lu