小编squ*_*ndy的帖子

jQuery就绪函数在WordPress中不起作用

我在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代码:警报弹出.所以准备好的功能不会起作用.任何人都可以告诉我为什么以及如何解决这个问题?谢谢.

wordpress

11
推荐指数
2
解决办法
4万
查看次数

如何使用 &lt;figure&gt; 实现标题和摄影师信用

我想创建一种标准方法来提供带有 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)

其中哪一个最好,为什么?

1

<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)

2

<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)

3

还有别的事...

html semantic-markup

7
推荐指数
1
解决办法
6365
查看次数

标签 统计

html ×1

semantic-markup ×1

wordpress ×1