zoukankan      html  css  js  c++  java
  • offset

    offsetParent(父级元素position是relative或absolute)

    width/height(内容的宽高)

    clientWidth=width+paddingleft+paddingright

    clientHeight=height+paddingtop+paddingbottom

    offsetWidth=width+paddingleft+paddingright+borderleft+borderright

    offsetheight=height+paddingtop+paddingbottom+bordertop+borderbottom

    offsetLeft=(offsetParent的padding-left)+(中间元素的offsetWidth)+(当前元素的margin-left)。

    offsetTop=(offsetParent的padding-top)+(中间元素的offsetHeight)+(当前元素的margin-top)。

    //jquery 对css的控制

    $('#divid').css('propertyName') //get property value

    $('#divid').css('propertyName','value') //set property value

    $('#divid').offset().top  //相对于浏览器

    $('#divid').offset().left

    $('#divid').position().top  //相对于最近设置过position的元素

    $('#divid').position().left

    $('#divid').scrollTop(offset)  //返回或设置

    $('#divid').height()  //content height

    $('#divid').outerHeight()  //等于offsetheight   outerHeight(true)=offsetheight+margin

    $(window).height()  //浏览器高度

    $('#divid').css('cssText')   //var csstxt = $('#selector').css('cssText') + ';top:100;left:100;border:1px solid red;color:#f00;';$('#selector').css('cssText', csstxt);

  • 相关阅读:
    python 自定义去掉空行
    JavaScript 获取时间函数
    python 自定义ssh
    python 去掉空行
    python roboot解析 output.xml
    语音识别-windows
    python 自定义request模块调试
    python 自定义装饰器
    python 自定义Server酱模块编写
    python 自定义exception模块
  • 原文地址:https://www.cnblogs.com/yfann/p/4753394.html
Copyright © 2011-2022 走看看