gpt4 book ai didi

javascript - 如何更改 `
` 及其父 `` 的高度

转载 作者:太空宇宙 更新时间:2023-11-04 01:23:38 25 4
gpt4 key购买 nike

我在第三方应用程序中有以下标记。现在对于这个第三方应用程序,我可以针对生成的标记编写自定义 JavaScript 和自定义 css。

<td style="height:75px">
<div style="height: 75px; opacity: 0.99;" id="MSOPictureLibrarySlideshowWebPart_ctl00_ctl40_g_79ca5882_ef72_482a_9f70_94b4a8c6804e_text">
<span id="MSOPictureLibrarySlideshowWebPart_ctl00_ctl40_g_79ca5882_ef72_482a_9f70_94b4a8c6804e_title" class="ms-slideshow-title"></span><br>
</div>
</td>

那么我该如何修改 <div> 的高度属性呢?及其 parent <td>来自 style="height:75px"style="height:0px" ??

最佳答案

这将选择所有 <td>元素和所有 <div>直接位于 <td> 内的元素并使他们的高度0px

$("td, td > div").height(0);

先试试这个,但是,我怀疑这会选择比你想要的更多的东西,这取决于这个页面上的其他内容。

如果所有的 div 元素都有一个以 MSOPictureLibrarySlideshowWebPart 开头的 ID然后您可以从那里开始,选择所有这些,然后找到父元素。检查the jquery docs了解如何进行部分属性匹配。

$("div[id^='MSOPictureLibrarySlideshowWebPart']").each(function() {
$(this).height(0).parent().height(0);
});

关于javascript - 如何更改 `<Div>` 及其父 `<Td>` 的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48522635/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com