我在WordPress上使用jQuery(@the HOME页面),ready函数对我不起作用.我有一个index.php,它包括(php)页眉,页脚和侧边栏.我测试了这段代码:
<script type="text/javascript" src="path_to_jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
alert ("test text");
});
</script>
Run Code Online (Sandbox Code Playgroud)
警报(带文字"test text")不会立即弹出!它只是在我的侧边栏加载后弹出.这意味着当我看到索引页面(侧栏未加载)时,我必须等待几秒钟,直到侧栏完成加载,然后才执行jQuery代码:警报弹出.所以准备好的功能不会起作用.任何人都可以告诉我为什么以及如何解决这个问题?谢谢.
我想创建一种标准方法来提供带有 alt 标签的图像,以实现可访问性和 SEO、描述性标题以及摄影师信用的单独元素。似乎每个元素只<figcaption>允许有一个<figure>,并且它必须是第一个或最后一个元素,因此排除了这样做:
<figure>
<img src="https://placedog.net/500/280" alt="a handsome pooch stares at the camera">
<figcaption class="caption">George, the doggo</figcaption>
<figcaption class="photo-credit">Photo: Jane Doe</figcaption>
</figure>
Run Code Online (Sandbox Code Playgroud)
其中哪一个最好,为什么?
<figure>
<img src="https://placedog.net/500/280" alt="a handsome pooch stares at the camera">
<div class="photo-credit">Photo: Jane Doe</div>
<figcaption class="caption">George, the doggo</figcaption>
</figure>
Run Code Online (Sandbox Code Playgroud)
<figure>
<img src="https://placedog.net/500/280" alt="a handsome pooch stares at the camera">
<figcaption>
<span class="caption">George, the doggo</span>
<span class="photo-credit">Photo: Jane Doe</span>
</figcaption>
</figure>
Run Code Online (Sandbox Code Playgroud)
还有别的事...