getNextElement DOM函数

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了getNextElement DOM函数相关的知识,希望对你有一定的参考价值。

Useful function for CSS DOM, returns the next element after the selected node. So you could style the element directly after a h1 element for example.
  1. function getNextElement(node) {
  2. if(node.nodeType == 1){
  3. return node;
  4. }
  5. if(node.nextSibling) {
  6. return getNextElement(node.nextSibling)
  7. }
  8. return null;
  9. }

以上是关于getNextElement DOM函数的主要内容,如果未能解决你的问题,请参考以下文章