jQuery css详解
生活随笔
收集整理的這篇文章主要介紹了
jQuery css详解
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
今天確確實實是放了一天假,喝了點小酒,看了天天向上和快樂大本營以及中國好舞蹈,越來越熱愛舞蹈了,還是總結一篇吧。
@jquery css
css(name|pro|[,val|fn):訪問或設置匹配元素的樣式屬性
1 $("div").click(function(){ 2 $(this).css({width:20px,height:30px}) 3 });offset([coordinates]):獲取匹配元素在當前視口(body)的相對偏移
1 <p>hello baby</p> 2 3 $("p").html("left:"+offset.left+",top:"+offset.top); 4 5 // offset().left就相當于與body的Margin-left 6 //offset().top就相當于與body的Margin-topposition():獲取或設置匹配元素相對父元素的偏移
1 $("p").html("left:"+$("p").position().left); 2 3 //position().left相當于與當前父元素的Margin-left; 4 //position().top相當于與當前父元素的Margin-top;scrollTop([val]):獲取匹配元素相對于滾動條頂部的偏移;
scrollLeft([val]):獲取匹配元素相對于滾動條左部的偏移;
height(val|fn):取得或設置匹配元素當前計算的高度值(高度)
1 $("p").height(20);width(val|fn):取得或設置匹配元素當前計算的寬度值(寬度);
innerHeight():獲取第一個匹配元素內部區域高度(高度+補白)
innerWidth():獲取第一個匹配元素內部區域寬度;
outerHeight([options]):獲取第一個匹配元素外部高度;
1 <p>HELLObaby</p> 2 3 $("p").html("outerHeight:"+$("p").outerHeight()+",outerHeight(true):"+$("p").outerHeight(true)); 4 5 //outerHeight() 表示高度+補白+邊框,當參數為true時,表示高度+補白+邊框+邊距;outerWidth([options]):獲取第一個匹配元素的外部寬度;
總結還不夠精煉,還需要逐步完善!!
轉載于:https://www.cnblogs.com/eyeSpace/p/3790219.html
總結
以上是生活随笔為你收集整理的jQuery css详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一步一步SharePoint 2007之
- 下一篇: jieba java_【NLP】【一】中