CSS是分层的;您将需要完善链条。假设您有两个<html>
<body style="display: none;">
<img src="https://via.placeholder.com/100" alt="">
<img src="https://via.placeholder.com/200" alt="">
<img src="https://via.placeholder.com/300" alt="">
<script>
const imageCollection = Array.from(document.getElementsByTagName('img'));
const promisifier = (imageNode) => {
return new Promise((resolve,reject) => {
imageNode.addEventListener("load",() => {
console.log('image loaded',imageNode);
resolve('Loaded')
});
})
}
Promise.all(imageCollection.map(img => promisifier(img))).then((resp)=>{
document.body.style.display = 'block';
console.log('All images completed Loading');
})
</script>
</body>
</html>
和#one
Poover,可以将#two
定位为使用CSS专门定位第一个popover-body。
#one .popover-body
失败,因为alert($('.popover-body').css('font-size'))
返回了NodeList个元素集合。例如,您将需要遍历它们(使用类似.each()
的东西),或者通过使用$('.popover-body')
进行索引来分别定位它们。
本文链接:https://www.f2er.com/3147614.html