获取指定元素的最近的兄弟姐妹,选择匹配的选择器。
finder.nextSibling(elm, selector, adjacent)
Example: 查找含有 “selected” 样式的 p 的兄弟元素。
<!DOCTYPE html> <html> <head> <style> li { margin: 3px; padding: 3px; background: #EEEEEE; } li.hilight { background: yellow; } </style> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script> <script> require.config({ baseUrl: "./", packages: [{ name: "skylark", location: "../../../src/skylark" }, ] }); </script> </head> <body> <p>Hello</p> <p>Hello Again</p> <p class="selected">And Again</p> <p class="selected">Agin And Again</p> <script> require(["skylark/styler", "skylark/finder"], function(styler, finder) { styler.css(finder.nextSibling(finder.find("p"), ".selected"), "background", "yellow"); }); </script> </body> </html>