01 2013 档案

摘要:在我们用javascript动态添加某一类型的元素时,这些元素需要绑定某一事件,比如click事件,那么我们就需要用到delegate函数如果我们在每一次动态添加这种类型的元素的时候,都为该元素绑定某一事件的话,这样比较浪费。delegate函数就是让我们为某一类型的元素只绑定一次某一事件即可,即使未来有若干次的删除或添加,该事件都有效。delegate 的函数是被某一类型的共同父元素调用,listNode.delegate('.condition-remove','click',function(e){e.preventDefault();$(this).pa 阅读全文
posted @ 2013-01-28 17:56 mabel_on_line 阅读(1005) 评论(0) 推荐(0)
摘要:自己写的 一个选择城市的插件 自豪感横生html:<input type="text" id="job_post_work_location" autocomplete="off">调用方法 $.bindCitySuggestion('#job_post_work_location');源码如下:(function($){ $.bindCitySuggestion = function(nodeSelector){ var node = $(nodeSelector), popularCity = [ 阅读全文
posted @ 2013-01-24 17:52 mabel_on_line 阅读(6184) 评论(0) 推荐(0)
摘要:$(document).mouseup(function(e){ var containers = $('#workplace_suggestion_section, #job_post_work_location'); containers.each(function(){ if($(this).has(e.target).length === 0){ suggestionSectionNode.hide(); } });}); 阅读全文
posted @ 2013-01-24 13:43 mabel_on_line 阅读(312) 评论(0) 推荐(0)
摘要:var x = companyNode.offset().left;var y = companyNode.offset().top+height; 阅读全文
posted @ 2013-01-23 17:02 mabel_on_line 阅读(372) 评论(0) 推荐(0)
摘要:jQuery插件的开发包括两种:$.fx是类级别的插件开发,即给jQuery添加新的全局函数,相当于给jQuery类本身添加方法,jQuery的全局函数就是属于jQuery命名空间的函数。调用:$.fx('#id');$.fn.fx是对象级别的插件开发,即给jQuery对象添加方法。 调用:$('#id').fx();参考资料http://www.iteye.com/topic/545971 阅读全文
posted @ 2013-01-23 16:44 mabel_on_line 阅读(2189) 评论(0) 推荐(2)
摘要:String.prototype.trim = function() { return $.trim(this);};(function($) {$.substitute = function(template, data) { return template.replace(/\{([\w\.]*)\}/g, function (str, key) { var keys = key.split("."), value = data[keys.shift()]; $.each(keys, function () { value =... 阅读全文
posted @ 2013-01-23 15:54 mabel_on_line 阅读(265) 评论(0) 推荐(0)
摘要:border-bottom:1px dashed#CCC; 阅读全文
posted @ 2013-01-16 15:37 mabel_on_line 阅读(669) 评论(0) 推荐(0)
摘要:http://apps.eky.hk/css-triangle-generator/注释:Internet Explorer 6(以及更早的版本)不支持属性值 "transparent"。border-colorhttp://www.w3school.com.cn/css/pr_border-color.aspwidth: 0px;height: 0px;border-style: solid;border-width: 0 100px 100px 100px;border-color: transparent transparent #007bff transparent 阅读全文
posted @ 2013-01-16 13:10 mabel_on_line 阅读(288) 评论(0) 推荐(0)
摘要:1.用在父元素.clear-box {overflow: auto;zoom: 1;}2.加在父元素所包含的带有浮动子元素的后面<div style="clear:both"></div> 阅读全文
posted @ 2013-01-15 11:55 mabel_on_line 阅读(149) 评论(0) 推荐(0)