• <nav id="cwumo"><code id="cwumo"></code></nav>
  • <menu id="cwumo"><strong id="cwumo"></strong></menu>

    jQuery中outerWidth的方法介紹

    時間:2024-07-13 09:34:58 jQuery 我要投稿
    • 相關推薦

    jQuery中outerWidth的方法介紹

      本文實例講述了jQuery中outerWidth()方法用法。分享給大家供大家參考。具體分析如下:

      此方法獲取第一個匹配元素外部寬度。

      默認情況下外部高度是寬度(width)、內補白(padding)和邊框(border)之和。

      如果參數設置為true的話,外補白(margin)尺寸也會算入外部寬度。

      此方法對可見和隱藏元素均有效。

      可以與outerHeight()方法結合學習。

      語法結構:

      復制代碼 代碼如下:$(selector).outerWidth(options)

      參數列表:

      參數 描述 options 定義是否把外補白(margin)計算在內:

      一.fase,外補白不計算在內,默認值。

      二.true,外補白計算在內。

      實例代碼:

      復制代碼 代碼如下:

      div{

      background-color:green;

      height:100px;

      width:200px;

      padding:10px;

      margin:10px;

      border:5px solid red;

      }

      $(document).ready(function(){

      $("button").click(function(){

      $("div").text($("div").outerWidth(true))

      })

      })

      此處顯outerWidth()數值

      點擊查看div的outerWidth

      點擊按鈕可以顯示div的元素外部寬度。

      希望本文所述對大家的jQuery程序設計有所幫助。

    【jQuery中outerWidth的方法介紹】相關文章:

    jQuery中prev()方法用法07-16

    jQuery中replaceAll()方法用法10-15

    關于jQuery實現高亮顯示的方法介紹08-20

    asp.net+jquery Jsonp使用方法介紹08-23

    關于jquery簡單圖片切換顯示效果實現方法介紹10-01

    jQuery中parent()和siblings()的問題10-16

    jQuery程序設計08-05

    jquery提交按鈕的代碼07-28

    手繪中的透視方法08-18

    淺析jQuery 遍歷函數javascript08-06

    日韩激情