这是我第一次尝试让我的jQuery代码在codeacademy.com以外的地方工作,所以请耐心等待.
我有三个文件,index.html,stylesheet.css和script.js(加上几张图片)都在同一个文件夹中.index.html和style.css相互配合得很好,但是无论我放入什么内容,script.js似乎根本不想采取任何效果(使用命令就像在$上隐藏段落一样简单(文档) ).准备...
这是index.html:
Title test test test
![]()
这是stylesheet.css:
a { text-decoration:none; } body { background-image: url("debut_light.png"); } .mainh1 { text-align: left; font-family: 'Cantora One', sans-serif; color: #556270; font-size: 25px; text-shadow: 0 2px 0 #fff; margin: 0; margin-top: 75px; margin-left: 25px; line-height: 150%; display: inline-block; } #email { color: #03738E; } #city { color: #F1B703; } #tinker { color: #F15B07; } #coffee { color: #D92D01; } .image { height: 400px; width: 400px; float: right; overflow: hidden; margin-top: 75px; margin-right: 50px; border-radius: 20px; } .image img { width: 100%; height: 100%; }
这是script.js:
$(document).ready( function() { $('p').fadeOut('slow'); });
我也尝试链接script.js的整个源路径,我尝试将它上传到hostgator.com上的服务器但无济于事.知道为什么我的jquery不工作吗?如果这是一个简单的错误,请耐心等待,这是我编码的第5天.
你还没有加载jQuery.在加载脚本之前添加此代码:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>