1. var curCSS, iframe,
  2. // swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
  3. // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  4. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5. rmargin = /^margin/,
  6. rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
  7. rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
  8. rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ),
  9. elemdisplay = { BODY: "block" },
  10.  
  11. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  12. cssNormalTransform = {
  13. letterSpacing: 0,
  14. fontWeight: 400
  15. },
  16.  
  17. cssExpand = [ "Top", "Right", "Bottom", "Left" ],
  18. cssPrefixes = [ "Webkit", "O", "Moz", "ms" ];
  19.  
  20. // return a css property mapped to a potentially vendor prefixed property
  21. function vendorPropName( style, name ) {
  22.  
  23. // shortcut for names that are not vendor prefixed
  24. if ( name in style ) {
  25. return name;
  26. }
  27.  
  28. // check for vendor prefixed names
  29. var capName = name.charAt(0).toUpperCase() + name.slice(1),
  30. origName = name,
  31. i = cssPrefixes.length;
  32.  
  33. while ( i-- ) {
  34. name = cssPrefixes[ i ] + capName;
  35. if ( name in style ) {
  36. return name;
  37. }
  38. }
  39.  
  40. return origName;
  41. }
  42.  
  43. function isHidden( elem, el ) {
  44. // isHidden might be called from jQuery#filter function;
  45. // in that case, element will be second argument
  46. elem = el || elem;
  47. return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );//动态创建的元素也是不包含也是隐藏
  48. }
  49.  
  50. // NOTE: we've included the "window" in window.getComputedStyle
  51. // because jsdom on node.js will break without it.
  52. function getStyles( elem ) {
  53. return window.getComputedStyle( elem, null );//封装
  54. }
  55.  
  56. function showHide( elements, show ) {
  57. var display, elem, hidden,
  58. values = [],
  59. index = 0,
  60. length = elements.length;
  61.  
  62. for ( ; index < length; index++ ) {
  63. elem = elements[ index ];
  64. if ( !elem.style ) {
  65. continue;
  66. }
  67.  
  68. values[ index ] = data_priv.get( elem, "olddisplay" );
  69. display = elem.style.display;
  70. if ( show ) {
  71. // Reset the inline display of this element to learn if it is
  72. // being hidden by cascaded rules or not
  73. if ( !values[ index ] && display === "none" ) {
  74. elem.style.display = "";
  75. }
  76.  
  77. // Set elements which have been overridden with display: none
  78. // in a stylesheet to whatever the default browser style is
  79. // for such an element
  80. if ( elem.style.display === "" && isHidden( elem ) ) {
  81. values[ index ] = data_priv.access( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
  82. }
  83. } else {
  84.  
  85. if ( !values[ index ] ) {
  86. hidden = isHidden( elem );
  87.  
  88. if ( display && display !== "none" || !hidden ) {
  89. //获取元素原来的显示样式,块级元素是block行内元素是inline
  90. data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css(elem, "display") );
  91. }
  92. }
  93. }
  94. }
  95.  
  96. //每一个元素遍历
  97. for ( index = 0; index < length; index++ ) {
  98. elem = elements[ index ];
  99. if ( !elem.style ) {//有sytle属性通过style属性隐藏显示,没有就跳出。
  100. continue;
  101. }
  102. if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
  103. //values[ index ] || "",values[ index ]不存在时给空就是false,不直接写 = show ? 'block' :'none',因为是行内元素就不能是block而是in-line,
  104. //元素一上来是隐藏状态是获取不到元素的display属性是块级还是行内,调用show的时候通过elem.nodeName动态创建,获取元素是块级还是行内。
  105. elem.style.display = show ? values[ index ] || "" : "none";
  106. }
  107. }
  108.  
  109. return elements;
  110. }
  111.  
  112. jQuery.fn.extend({
  113. //$('#div1').css('color','yellow');
  114. css: function( name, value ) {
  115. return jQuery.access( this, function( elem, name, value ) {
  116. var styles, len,
  117. map = {},
  118. i = 0;
  119. //$('#div1').css( ['color','backgroundColor','width'] )
  120. if ( jQuery.isArray( name ) ) {//数组获取
  121. styles = getStyles( elem );
  122. len = name.length;
  123.  
  124. for ( ; i < len; i++ ) {
  125. //调用jQuery.css()方法来获取
  126. //jQuery.css方法多个值获取传了4个参数,第三个参数是false相当于没传,只是占位隔开第四个参数,
  127. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  128. }
  129.  
  130. return map;
  131. }
  132.  
  133. return value !== undefined ?
  134. jQuery.style( elem, name, value ) ://设置:$('#div1').css('color','yellow')
  135. jQuery.css( elem, name );//获取:$('#div1').css('color'),单个值获取只传了2个参数,后面2个参数没传相当于是false,
  136. }, name, value, arguments.length > 1 );
  137. },
  138. show: function() {
  139. return showHide( this, true );
  140. },
  141. hide: function() {
  142. return showHide( this );//没传就是false
  143. },
  144. toggle: function( state ) {
  145. if ( typeof state === "boolean" ) {
  146. return state ? this.show() : this.hide();
  147. }
  148.  
  149. return this.each(function() {
  150. if ( isHidden( this ) ) {//jQuery对象里面每一个元素是js节点对象
  151. jQuery( this ).show();
  152. } else {
  153. jQuery( this ).hide();
  154. }
  155. });
  156. }
  157. });
  158.  
  159. jQuery.extend({
  160. // Add in style property hooks for overriding the default
  161. // behavior of getting and setting a style property
  162. cssHooks: {
  163. opacity: {//透明度处理
  164. get: function( elem, computed ) {
  165. if ( computed ) {
  166. // We should always get a number back from opacity
  167. var ret = curCSS( elem, "opacity" );
  168. return ret === "" ? "1" : ret;
  169. }
  170. }
  171. }
  172. },
  173.  
  174. // Don't automatically add "px" to these possibly-unitless properties
  175. cssNumber: {
  176. "columnCount": true,
  177. "fillOpacity": true,
  178. "fontWeight": true,
  179. "lineHeight": true,
  180. "opacity": true,
  181. "order": true,
  182. "orphans": true,
  183. "widows": true,
  184. "zIndex": true,
  185. "zoom": true
  186. },
  187.  
  188. // Add in properties whose names you wish to fix before
  189. // setting or getting the value
  190. cssProps: {
  191. // normalize float css property
  192. "float": "cssFloat"
  193. },
  194.  
  195. //设置:jQuery.style( $('#div1')[i], 'float','left' )
  196. style: function( elem, name, value, extra ) {
  197. //元素节点的节点类型是3或者8,
  198. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  199. return;
  200. }
  201. // Make sure that we're working with the right name
  202. var ret, type, hooks,
  203. origName = jQuery.camelCase( name ),//转驼峰,background-color --> backgroundColor
  204. style = elem.style;//元素的所有style
  205. //有就返回,没有就加入cssProps这个json,全部保存在$这个对象中。将float转成cssfloat,
  206. name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
  207. // gets hook for the prefixed version
  208. // followed by the unprefixed version
  209. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  210. // Check if we're setting a value
  211. if ( value !== undefined ) {//设置
  212. type = typeof value;
  213. // convert relative number strings (+= or -=) to relative numbers. #7345
  214. //$('#div1').css('width','+=100');
  215. if ( type === "string" && (ret = rrelNum.exec( value )) ) {
  216. value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
  217. // Fixes bug #9237
  218. type = "number";
  219. }
  220. // value是空或者无限大,设置时候就返回,
  221. if ( value == null || type === "number" && isNaN( value ) ) {
  222. return;
  223. }
  224. // origName不在jQuery.cssNumber中,在jQuery.cssNumber中不需要加单位。
  225. if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
  226. value += "px";//加单位
  227. }
  228.  
  229. // Fixes #8908, it can be done more correctly by specifying setters in cssHooks,
  230. // but it would mean to define eight (for every problematic property) identical functions
  231. if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
  232. style[ name ] = "inherit";
  233. }
  234.  
  235. // If a hook was provided, use that value, otherwise just set the specified value
  236. if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
  237. style[ name ] = value;//没有兼容性,通过style.name = value设置
  238. }
  239.  
  240. } else {//获取
  241. // If a hook was provided get the non-computed value from there
  242. if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
  243. return ret;
  244. }
  245.  
  246. // 没有兼容性,通过style.name获取
  247. return style[ name ];
  248. }
  249. },
  250.  
  251. //获取:jQuery.css( $('#div1')[i], 'color' );
  252. css: function( elem, name, extra, styles ) {
  253. var val, num, hooks,
  254. //$('#div1').css('background-color'); odiv.style.background-color是不行的,转驼峰成backgroundColor
  255. origName = jQuery.camelCase( name );//转驼峰,
  256.  
  257. /*
  258. cssProps: {
  259. "float": "cssFloat" //class js中通过 className代表
  260. },
  261. */
  262. //有就返回,没有就加入cssProps这个json,全部保存在$这个对象中。
  263. name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
  264. // gets hook for the prefixed version
  265. // followed by the unprefixed version
  266. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  267.  
  268. // 获取值的兼容性处理
  269. if ( hooks && "get" in hooks ) {
  270. val = hooks.get( elem, true, extra );
  271. }
  272.  
  273. // 不做兼容性处理调用curCSS方法获取
  274. if ( val === undefined ) {
  275. val = curCSS( elem, name, styles );
  276. }
  277.  
  278. /*
  279. cssNormalTransform = {
  280. letterSpacing: 0,
  281. fontWeight: 400
  282. },
  283. 返回的值是normal,并且属性名是letterSpacing、fontWeight就返回0、40
  284. */
  285. if ( val === "normal" && name in cssNormalTransform ) {
  286. val = cssNormalTransform[ name ];
  287. }
  288.  
  289. // 额外参数做判断
  290. if ( extra === "" || extra ) {
  291. num = parseFloat( val );//123px转换成123
  292. return extra === true || jQuery.isNumeric( num ) ? num || 0 : val;
  293. }
  294. return val;
  295. }
  296. });
  297.  
  298. //curCSS( $('#div1')[i], 'color')
  299. curCSS = function( elem, name, _computed ) {
  300. var width, minWidth, maxWidth,
  301. computed = _computed || getStyles( elem ),//getStyles调用原生window.getComputedStyle( elem, null );提高性能
  302.  
  303. // Support: IE9
  304. // getPropertyValue is only needed for .css('filter') in IE9, see #12537
  305. ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined,
  306. style = elem.style;
  307.  
  308. if ( computed ) {
  309. //ownerDocument获取元素所在页面的document,动态创建一个元素var $span = $('<span>') 就不包含,调用jQuery.style方法来获取,
  310. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  311. ret = jQuery.style( elem, name );
  312. }
  313.  
  314. // Support: Safari 5.1
  315. // A tribute to the "awesome hack by Dean Edwards"
  316. // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
  317. // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
  318. if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
  319.  
  320. // Remember the original values
  321. width = style.width;
  322. minWidth = style.minWidth;
  323. maxWidth = style.maxWidth;
  324.  
  325. // Put in the new values to get a computed value out
  326. style.minWidth = style.maxWidth = style.width = ret;
  327. ret = computed.width;
  328.  
  329. // Revert the changed values
  330. style.width = width;
  331. style.minWidth = minWidth;
  332. style.maxWidth = maxWidth;
  333. }
  334. }
  335.  
  336. return ret;
  337. };
  338.  
  339. function setPositiveNumber( elem, value, subtract ) {
  340. var matches = rnumsplit.exec( value );
  341. return matches ?
  342. // Guard against undefined "subtract", e.g., when used as in cssHooks
  343. Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
  344. value;
  345. }
  346.  
  347. function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
  348. var i = extra === ( isBorderBox ? "border" : "content" ) ?
  349. // If we already have the right measurement, avoid augmentation
  350. 4 :
  351. // Otherwise initialize for horizontal or vertical properties
  352. name === "width" ? 1 : 0,
  353.  
  354. val = 0;
  355.  
  356. for ( ; i < 4; i += 2 ) {
  357. // both box models exclude margin, so add it if we want it
  358. if ( extra === "margin" ) {
  359. val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
  360. }
  361.  
  362. if ( isBorderBox ) {
  363. // border-box includes padding, so remove it if we want content
  364. if ( extra === "content" ) {
  365. val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  366. }
  367.  
  368. // at this point, extra isn't border nor margin, so remove border
  369. if ( extra !== "margin" ) {
  370. val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  371. }
  372. } else {
  373. // at this point, extra isn't content, so add padding
  374. val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  375.  
  376. // at this point, extra isn't content nor padding, so add border
  377. if ( extra !== "padding" ) {
  378. val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  379. }
  380. }
  381. }
  382.  
  383. return val;
  384. }
  385.  
  386. function getWidthOrHeight( elem, name, extra ) {
  387.  
  388. // Start with offset property, which is equivalent to the border-box value
  389. var valueIsBorderBox = true,
  390. val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
  391. styles = getStyles( elem ),
  392. isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
  393.  
  394. // some non-html elements return undefined for offsetWidth, so check for null/undefined
  395. // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
  396. // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
  397. if ( val <= 0 || val == null ) {
  398. // Fall back to computed then uncomputed css if necessary
  399. val = curCSS( elem, name, styles );
  400. if ( val < 0 || val == null ) {
  401. val = elem.style[ name ];
  402. }
  403.  
  404. // Computed unit is not pixels. Stop here and return.
  405. if ( rnumnonpx.test(val) ) {
  406. return val;
  407. }
  408.  
  409. // we need the check for style in case a browser which returns unreliable values
  410. // for getComputedStyle silently falls back to the reliable elem.style
  411. valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
  412.  
  413. // Normalize "", auto, and prepare for extra
  414. val = parseFloat( val ) || 0;
  415. }
  416.  
  417. // use the active box-sizing model to add/subtract irrelevant styles
  418. return ( val +
  419. augmentWidthOrHeight(
  420. elem,
  421. name,
  422. extra || ( isBorderBox ? "border" : "content" ),
  423. valueIsBorderBox,
  424. styles
  425. )
  426. ) + "px";
  427. }
  428.  
  429. //元素一上来是隐藏状态是获取不到元素的display属性是块级还是行内,调用show的时候通过elem.nodeName动态创建,获取元素是块级还是行内。
  430. //css_defaultDisplay(elem.nodeName) elem.nodeName=div或者span
  431. function css_defaultDisplay( nodeName ) {
  432. var doc = document,
  433. /*
  434. elemdisplay = { BODY: "block" },
  435. */
  436. display = elemdisplay[ nodeName ];
  437.  
  438. if ( !display ) {//元素是body就是block,不是body就动态创建然后获取display属性,因为body不能动态创建
  439. display = actualDisplay( nodeName, doc );//动态创建
  440.  
  441. // iframe情况
  442. if ( display === "none" || !display ) {
  443. //动态创建iframe
  444. iframe = ( iframe ||
  445. jQuery("<iframe frameborder='0' width='0' height='0'/>")
  446. .css( "cssText", "display:block !important" )
  447. ).appendTo( doc.documentElement );
  448.  
  449. // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
  450. doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document;
  451. doc.write("<!doctype html><html><body>");
  452. doc.close();
  453. //获取iframe里面的节点的display属性
  454. display = actualDisplay( nodeName, doc );
  455. iframe.detach();
  456. }
  457.  
  458. // Store the correct default display
  459. elemdisplay[ nodeName ] = display;
  460. }
  461.  
  462. return display;
  463. }
  464.  
  465. // 动态创建元素actualDisplay( span, document )
  466. function actualDisplay( name, doc ) {
  467. var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),//创建添加到body中,动态创建元素肯定是显示的,
  468. display = jQuery.css( elem[0], "display" );//获取display值
  469. elem.remove();
  470. return display;
  471. }
  472.  
  473. jQuery.each([ "height", "width" ], function( i, name ) {
  474. jQuery.cssHooks[ name ] = {
  475. get: function( elem, computed, extra ) {
  476. if ( computed ) {
  477. // certain elements can have dimension info if we invisibly show them
  478. // however, it must have a current display style that would benefit from this
  479. return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ?
  480. jQuery.swap( elem, cssShow, function() {
  481. return getWidthOrHeight( elem, name, extra );
  482. }) :
  483. getWidthOrHeight( elem, name, extra );
  484. }
  485. },
  486.  
  487. set: function( elem, value, extra ) {
  488. var styles = extra && getStyles( elem );
  489. return setPositiveNumber( elem, value, extra ?
  490. augmentWidthOrHeight(
  491. elem,
  492. name,
  493. extra,
  494. jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  495. styles
  496. ) : 0
  497. );
  498. }
  499. };
  500. });
  501.  
  502. // These hooks cannot be added until DOM ready because the support test
  503. // for it is not run until after DOM ready
  504. jQuery(function() {
  505. // Support: Android 2.3
  506. if ( !jQuery.support.reliableMarginRight ) {
  507. jQuery.cssHooks.marginRight = {
  508. get: function( elem, computed ) {
  509. if ( computed ) {
  510. // Support: Android 2.3
  511. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  512. // Work around by temporarily setting element display to inline-block
  513. return jQuery.swap( elem, { "display": "inline-block" },
  514. curCSS, [ elem, "marginRight" ] );
  515. }
  516. }
  517. };
  518. }
  519.  
  520. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  521. // getComputedStyle returns percent when specified for top/left/bottom/right
  522. // rather than make the css module depend on the offset module, we just check for it here
  523. if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
  524. jQuery.each( [ "top", "left" ], function( i, prop ) {
  525. jQuery.cssHooks[ prop ] = {
  526. get: function( elem, computed ) {
  527. if ( computed ) {
  528. computed = curCSS( elem, prop );
  529. // if curCSS returns percentage, fallback to offset
  530. return rnumnonpx.test( computed ) ?
  531. jQuery( elem ).position()[ prop ] + "px" :
  532. computed;
  533. }
  534. }
  535. };
  536. });
  537. }
  538.  
  539. });
  540.  
  541. if ( jQuery.expr && jQuery.expr.filters ) {
  542. jQuery.expr.filters.hidden = function( elem ) {
  543. // Support: Opera <= 12.12
  544. // Opera reports offsetWidths and offsetHeights less than zero on some elements
  545. return elem.offsetWidth <= 0 && elem.offsetHeight <= 0;
  546. };
  547.  
  548. jQuery.expr.filters.visible = function( elem ) {
  549. return !jQuery.expr.filters.hidden( elem );
  550. };
  551. }
  552.  
  553. // These hooks are used by animate to expand properties
  554. jQuery.each({
  555. margin: "",
  556. padding: "",
  557. border: "Width"
  558. }, function( prefix, suffix ) {
  559. jQuery.cssHooks[ prefix + suffix ] = {
  560. expand: function( value ) {
  561. var i = 0,
  562. expanded = {},
  563.  
  564. // assumes a single number if not a string
  565. parts = typeof value === "string" ? value.split(" ") : [ value ];
  566.  
  567. for ( ; i < 4; i++ ) {
  568. expanded[ prefix + cssExpand[ i ] + suffix ] =
  569. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  570. }
  571.  
  572. return expanded;
  573. }
  574. };
  575.  
  576. if ( !rmargin.test( prefix ) ) {
  577. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  578. }
  579. });

jquery源码09 (6058 , 6620) css() : 样式的操作的更多相关文章

  1. jQuery 源码解析(二十六) 样式操作模块 样式详解

    样式操作模块可用于管理DOM元素的样式.坐标和尺寸,本节讲解一下样式相关,样式操作通过jQuery实例的css方法来实现,该方法有很多的执行方法,如下: css(obj)            ;参数 ...

  2. jQuery 源码解析(二十九) 样式操作模块 尺寸详解

    样式操作模块可用于管理DOM元素的样式.坐标和尺寸,本节讲解一下尺寸这一块 jQuery通过样式操作模块里的尺寸相关的API可以很方便的获取一个元素的宽度.高度,而且可以很方便的区分padding.b ...

  3. jQuery 源码解析(二十八) 样式操作模块 scrollLeft和scrollTop详解

    scrollLeft和scrollTop用于获取/设置滚动条的,如下: scrollLeft(val) ;读取或设置整个页面的水平滚动条距离 scrollTop(val) ;读取或设置整个页面的垂直滚 ...

  4. jQuery源码笔记(一):jQuery的整体结构

    jQuery 是一个非常优秀的 JS 库,与 Prototype,YUI,Mootools 等众多的 Js 类库相比,它剑走偏锋,从 web 开发的实用角度出发,抛除了其它 Lib 中一些中看但不实用 ...

  5. jQuery源码解析资源便签

    最近开始解读jQuery源码,下面的链接都是搜过来的,当然妙味课堂 有相关的一系列视频,长达100多期,就像一只蜗牛慢慢爬, 至少品读三个框架,以后可以打打怪,自己造造轮子. 完全理解jQuery源代 ...

  6. jQuery源码逐行分析学习01(jQuery的框架结构简化)

    最近在学习jQuery源码,在此,特别做一个分享,把所涉及的内容都记录下来,其中有不妥之处还望大家指出,我会及时改正.望各位大神不吝赐教!同时,这也是我的第一篇前端技术博客,对博客编写还不是很熟悉,美 ...

  7. jquery源码学习(一)——jquery结构概述以及如何合适的暴露全局变量

    jQuery 源码学习是对js的能力提升很有帮助的一个方法,废话不说,我们来开始学习啦 我们学习的源码是jquery-2.0.3已经不支持IE6,7,8了,因为可以少学很多hack和兼容的方法. jq ...

  8. jQuery源码分析笔记

    jquery-2.0.3.js版本源码分析 (function(){  (21,94) 定义了一些变量和函数 jQuery = function(){};  (96,283) 给JQ对象,添加一些方法 ...

  9. jQuery源码逐行分析学习02(第一部分:jQuery的一些变量和函数)

    第一次尝试使用Office Word,方便程度大大超过网页在线编辑,不过初次使用,一些内容不甚熟悉,望各位大神见谅~ 在上次的文章中,把整个jQuery的结构进行了梳理,得到了整个jQuery的简化结 ...

随机推荐

  1. struts2 validate验证

    转自:https://blog.csdn.net/houpengfei111/article/details/9038233 自定义拦截器 要自定义拦截器需要实现com.opensymphony.xw ...

  2. 如何配置MySQL?(三)

    要进行mysql配置,首先要找到mysql的配置向导文件,这个配置向导文件就在我们安装目录下的一个bin的子目录下. 刚才我们是选择典型安装MySQL,一般windows是默认存储在C:\Progra ...

  3. SSRS 报表 如何匿名查看

    SSRS 报表 如何匿名查看 昨晚一直研究怎么能匿名访问报表然后给客户看呢? 研究了好几种办法 我试过的分为三种,其中推荐我认为相对可控一点. .修改SSRS配置文件来禁止他验证登陆用户权限 操作过的 ...

  4. error C4996: 'setmode': The POSIX name for this item is deprecated解决方案

    在使用VS2012编译zlib库官方提供的案例程序 zpipe.c 中代码时报错: 信息如下: 错误 1 error C4996: 'setmode': The POSIX name for this ...

  5. ScrollView嵌套GridView不显示顶部

    /*     * scrollView中嵌套GridView不能显示头部     *      * 方案①:scrollView.smoothScrollTo(0, 0);     *      * ...

  6. html5开发页游(前话)

    导师要求模仿某个页游网站开发益智小游戏.老板的要求是要跨平台,IOS,Android.PC.Mac等系统主要通过浏览器打开都能用.那个网站的页游是通过flash实现的,使用这种方法肯定不能满足老板的要 ...

  7. iview 分页的案例

    //html部分 //js部分

  8. Ubuntu 18.04图形化软件包管理器

    1.ubuntu软件这个管理工具提供了一种管理您系统中软件的好方法,通过他可以很直观的查找软件安装很简单,打开终端,输入以下命令:----------------------------------- ...

  9. 为什么 linux 上不能用 localhost 链接数据库?

         因为 linux 连接的时候不是通过 tcp 协议,而是通过 sockect 来连接.所以 写localhost 之后就会默认去找 sockect 链接[此文件在 /var/lib/mysq ...

  10. 编译php并与nginx整合

    告诉 Nginx 如何处理 php 文件:          nginx>vim  conf/nginx.conf                     location ~ \.php${ ...