![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
jQuery
梦想作坊
这个作者很懒,什么都没留下…
展开
-
详解jquery插件中;(function ( $, window, document, undefined )的作用
在jquery插件中我们经常看到以下这段代码123;(function ( $, window, document, undefined ){//函数体内具体代码})(jQuery, window,document);对于很多初学者来说很难明白这表示什么,下边我将为大家介绍其相应的作用。转载 2017-08-16 09:59:57 · 306 阅读 · 0 评论 -
转换颜色值rgb格式为#xxx格式
通过jQuery的CSS获取的颜色值为rgba形式的值,需要转换成#XXX形式方便控制。var color = $(".chineseText").css("color");color = rgb2hex(color);/*转换颜色值rgb格式为#xxx格式*/function rgb2hex(rgb) { rgb = rgb.match(/^rgb\((\d+),\s原创 2018-01-08 16:54:27 · 2294 阅读 · 0 评论 -
设置当前元素为最顶级Z-index
很多页面点击或者拖动的过程需要将当前选中的元素置顶为最顶级的元素,避免被遮挡。/* 获取页面最大的z-index值 */function getMaxZIndex() { var maxZ = Math.max.apply(null, $.map($('body *'), function(e,n) { if ($(e).css('position'原创 2018-01-08 16:58:14 · 3079 阅读 · 0 评论