jquery - 什么是正确的 Jquery document.ready 换行

标签 jquery document-ready

我正在尝试复制其他用户在下面的代码中所做的事情:

Jquery Show and Hide doesnt work? Something is missing and i can't figure it out

但就像她一样,我也陷入困境,因为它在 Dreamweaver 中不起作用。我想我没有通过添加正确的包装来正确地做到这一点。有知道的人可以指出或编辑我的脚本吗?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>



<script type="text/javascript">
jQuery(document).ready(function($) 
{
    $(".social").hover(function() 
    {
        $("h1", this).hide();
        $(".networks", this).fadeIn();
    }, 
    function() 
    {
        $(".networks", this).hide();
        $("h1", this).fadeIn();
    });
});
</script>

<style>
.networks 
{
    display:none;
}
</style>
</head>

<body>
<div class="social">
    <h1>Share this</h1>
    <div class="networks">
        <p>Twitter</p>
        <p>Facebook</p>
    </div>
</div>      

</body>
</html>

最佳答案

您可以引用正确的地址:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

关于jquery - 什么是正确的 Jquery document.ready 换行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15193338/

相关文章:

javascript - 打开隐藏的 iframe 以在文档准备好时下载文件

javascript - 如果单击任何 slider <li>,如何在 bxSlider 中移动中心 <li>?

javascript - jQuery 插件函数覆盖

javascript - JS window.onload 用法与文档

javascript (jquery) - 代码应该位于 -> onload 或 document.ready 或 pageLoad()?

javascript - jsfiddle问题

javascript - 结合 jQuery 准备 + 更改

javascript - 防止页面不断重新加载

javascript - 困惑——我的 XMLHttpRequest 的 readyState 为 0,状态为 200

javascript - 如何计算 jQuery 中两个日期之间的月份?