图片预加载:(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");新窗口打开链接$("a[@rel$="external"]").click(function(){ this.target = "_blank";});/* Usage: www.fanwen112.com*/平滑滚动$(document).ready(function() {$("a.topLink").click(function() {$("html, body").animate({scrollTop: $($(this).attr("href")).offset().top + "px"}, {duration: 500,easing: "swing"});return false;});});鼠标划入时渐入渐出$(document).ready(function(){ $(".thumbs img").fadeTo("slow", 0.6); // This sets the opacity of the thumbs to fade down to 60% when the page loads $(".thumbs img").hover(function(){ $(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover },function(){ $(this).fadeTo("slow", 0.6); // This should set the opacity back to 60% on mouseout });});等高的列var max_height = 0;$("div.col").each(function(){ if ($(this).height() > max_height) { max_height = $(this).height(); }});$("div.col").height(max_height);老版本浏览器html5支持(function(){ if(!/*@[email protected]*/0) return; var 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测试浏览器是否支持css3var supports = (function() { var div = document.createElement("div"), vendors = "Khtml Ms O Moz Webkit".split(" "), len = vendors.length; 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";取得url中的参数$.urlParam = function(name){var results = new RegExp("[?&]" + name + "=([^&#]*)").exec(window.location.href);if (!results) { return 0; }return results[1] || 0;}禁用回车提交表单$("#form").keypress(function(e) { if (e.which == 13) { return false; }});
jquery ajax实例代码_jquery常用代码总结
范文推荐
- 万圣节的传统游戏
- 运输居间合同范本简单
- 年终物业小区工作总结简短2022
- 【2019外贸形势】2019年外贸销售业务员月个人总结范文
- [2018政协闭幕时间]2018年政协第十五届委员会常务委员会工作报告
- 2012年音乐、美术教师个人年终工作总结
- 乡镇关于扫盲工作计划|乡镇关于扫盲工作的自查报告
- 大二学期末个人总结
- 2018年质量月活动主题|2018年“质量月”活动工作方案
- 话务员工作思路【三篇】
- 2019年寒假学生社会实践活动总结|学生社会实践活动总结精选
- 保育员学期工作总结三篇
- 【描写阴天的句子】描写阴天的好段
- 物业管理春节联欢主持人致辞范文
- 2020企业劳务输出合同
- 不忘初心牢记使命主题教育活动总结
- 大学生寒假兼职心得范文
- 纪检部个人工作总结|纪检部工作总结
- 最新单位个人工作辞职报告范文
- 十月份人事政工科副科长工作总结