WordPress JavaScript
WordPress JavaScript
我正在尝试在 WordPress 管理自定义 post 的“Publish Metabox”中实现自定义选项。我想知道有什么本机方法可以做 expand/collapse div(查看下面的屏幕截图)。
我想知道WordPress本身是如何实现如下截图的? (也许像 bootstrap JS 库那样匹配 ID?)。
And I want to know is there any native way to do expand/collapse divs.
有。 Wordpress 在管理端使用 jQuery 库作为交互元素。在这种情况下,它只是使用一个简单的切换效果。
Display or hide the matched elements.
$( "button" ).click(function() {
$( "p" ).toggle();
});
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<button>Toggle</button>
<p style="display:none;">Good Bye</p>
我正在尝试在 WordPress 管理自定义 post 的“Publish Metabox”中实现自定义选项。我想知道有什么本机方法可以做 expand/collapse div(查看下面的屏幕截图)。
我想知道WordPress本身是如何实现如下截图的? (也许像 bootstrap JS 库那样匹配 ID?)。
And I want to know is there any native way to do expand/collapse divs.
有。 Wordpress 在管理端使用 jQuery 库作为交互元素。在这种情况下,它只是使用一个简单的切换效果。
Display or hide the matched elements.
$( "button" ).click(function() {
$( "p" ).toggle();
});
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
<button>Toggle</button>
<p style="display:none;">Good Bye</p>