Trying to get simple jquery animations on a site I created in Dreamweaver
Hey guys, another question. I'm trying to do some basic jQuery stuff for my final project. I'll be using it to modify my already existing site 开发者_如何学JAVAcreated in Dreamweaver a few months ago.
However, no matter how I source the framework, it just won't take regardless of whether I host my own copy or link to someone else's like Google's.
I'm including my jQuery function calls within my already existing .js file that includes some auto generated functions. I also tried creating a new .js specifically for my jQuery functions and still nothing.
I realize this is vague, but any tips? Do I need another framework for jQuery to work off of to make animations like
.fadeIn()
or .slideDown()
?
Thanks guys and gals!
Just jQuery will work for this, however you need to make sure you're calling the functions on document.ready
, like this:
$(function() { //or $(document).ready(function() {
$("#myID").fadeIn();
});
Generally speaking, you should wrap all your startup/binding code in a document.ready
wrapper like above, you can stick whatever you need in that one wrapper.
If you have just $("#myID").fadeIn();
and it's not at the bottom of your body, then it's probably running before the element exists, so that selector doesn't actually find the element...so nothing to fade in. You can see this behavior by placing this wherever your code currently is:
alert("#myID count: " + $("#myID").length); //probably alerts 0 currently
If this isn't the issue...check your console for javascript errors :)
精彩评论