zoukankan      html  css  js  c++  java
  • jsoffsetParent探索 简单

    最近在处理拖动问题时,总算是深入探索了一下offsetParent的问题:

    先看看定义官方定义:

    offsetParent returns a reference to the object which is the closest (nearest in the containment hierarchy) positioned containing element. If the element is non-positioned, the root element (html in standards compliant mode; body in quirks rendering mode) is the offsetParentoffsetParent returns null when the element has style.display set to "none".

    简单解释就是:

    1. 假设结果节点的display不是none:

    返回结果是一个dom节点,并且该节点具有定位属性(absolute, relative, fixed(ie7+)),如果父节点都不满足条件,则追溯到body(ie6、7在standard模式下返回html,ie在怪异模式下返回body)

    2. 如果display是none:

    在ie6、7(标准模式)(ie6、7、8怪异模式下返回)下返回满足上述条件的父节点;其他浏览器都返回undefined

    参考:

    http://www.cnblogs.com/jilleanwong/archive/2008/09/21/1295415.html

  • 相关阅读:
    java面向对象小总结
    eclipce 快捷键
    linux中查找和过滤的用法:find,grep
    shell脚本
    条形码和二维码
    Json简介
    牛客练习
    输入流操作
    Java编码
    maven入门
  • 原文地址:https://www.cnblogs.com/chyong168/p/2256114.html
Copyright © 2011-2022 走看看