随笔分类 - Web 前端-Javascript(jQuery)
摘要:/** * @method 产生类型判断函数的工厂 * @param {String} type 类型(String,Array,Number,NaN) * @return {Function} 类型判断函数 */var isType = function(type) { // var toString = Object.prototype.toString; //obj 需要被验证的对象 return window[is + type]||function(obj) { return toString.call(obj) == '[object ' + ...
阅读全文
摘要:先贴上我的初始化代码,可能是用法问题冤枉了百度编辑器,如果是我的用法有问题欢迎大侠们指正 简易编辑器 就要一个框框 View Code 提供的事件监听是这样的://事件editor.addListener("contentChan...
阅读全文
摘要:radio$("input[name='TemType']:checked").val();selecte取值操作$('#testSelect option:selected').text();或$("#testSelect").find('option:selected').text();或$("#testSelect").val();checkbox$('input[name=close]').is (":checked") 是否选中$('
阅读全文
摘要:监听滚动条和浏览器大小变化:$(document).ready(function() { //监听滚动条的变化 $(window).scroll(function() { ddd(); }); //监听浏览器大小变化 $(window).bind("resize", ddd); });一个dom元素距离页面顶部(包括了滚动条)的位置:$template.offset().top;滚动条到顶部的垂直高度 :$(d...
阅读全文
摘要:$('#clickme').click(function() { $('#book').animate({ opacity: 0.25, left: '+=50', height: 'toggle' }, 5000, function() { // Animation complete. });});
阅读全文
摘要:Wrap an HTML structure around each element in the set of matched elements. .wrap()Wrap an HTML structure around all elements in the set of matched elements. .wrapAll()Wrap an HTML structure around the content of each element in the set of matched elements. ...
阅读全文
摘要:事件绑定时常用的操作,用jquery绑定事件做个记录几点总结:用live绑定,如果新添加元素的元素符合选择器的筛选,则新元素自动被绑定事件live和bind(或on)是相互独立的,绑定事件会叠加用bind或on绑定的事件移除需用unbind用live绑定的事件需用die移除如果事件处理函数不是匿名函数的形式(来自外部定义)只写函数名称不要加括号live的绑定方法示例:$("table tr").live({mouseenter:function(){},mouseleave:function(){}});补充:新浪的一位牛人建议对Dom绑定事件时,在dom上添加class作
阅读全文
浙公网安备 33010602011771号