jQuery fade in on mouseover
I know this is a bit trivial but I just picked up jQuery tonight to add a little somethin somethin to my practice website, BUT I just cant seem to get this little script I wrote to work. Thanks in advance.
$(doc开发者_StackOverflowument).ready(function(){
$("p4").fadeTo("slow", 0.25);
$("p4").mouseover(function(){$("p4").fadeTo("fast",1.00);});
$("p4").mouseout(function(){$("p4").fadeTo("slow",0.25);});
});
<div id="p4" align="left">
BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAH BLAHfffffffffffffffffffffffffffffffffffffffffff
</div>
I also have some CSS
I imagine your HTML looks like <div id="p4"></div>
.
So, you need to use $("#p4")
everywhere to find an id
, instead of $("p4")
(which is actually looking for <p4></p4>
).
http://jsfiddle.net/84k7e/
When using jquery, you need to have libraries downloaded. Since most people dont have them unless they do heavy webdesign you have to import it from a host such as Google or Microsoft...
Using this code solved the problem:
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
</script>
Thank all for your guidance! I appreciate it!
精彩评论