尝试在我在 Dreamweaver 中创建的网站上获取简单的 jquery 动画

发布于 2024-09-01 04:01:59 字数 366 浏览 3 评论 0原文

嘿伙计们,还有一个问题。我正在尝试为我的最终项目做一些基本的 jQuery 工作。我将使用它来修改几个月前在 Dreamweaver 中创建的现有网站。

然而,无论我如何获取该框架,无论我是托管自己的副本还是链接到其他人(例如 Google)的副本,都不会需要它。

我将 jQuery 函数调用包含在现有的 .js 文件中,其中包含一些自动生成的函数。我还尝试专门为我的 jQuery 函数创建一个新的 .js,但仍然一无所获。

我意识到这很模糊,但是有什么提示吗?我是否需要另一个 jQuery 框架来制作像

.fadeIn().slideDown() 这样的动画?

谢谢大家!

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 created 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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

够钟 2024-09-08 04:01:59

只需 jQuery 即可实现此目的,但是您需要确保调用 document.ready 上的函数,如下所示:

$(function() { //or $(document).ready(function() {
  $("#myID").fadeIn();
});

一般来说,您应该将所有启动/绑定代码包装在 >document.ready 包装器就像上面一样,您可以在该包装器中粘贴您需要的任何内容。

如果您只有 $("#myID").fadeIn(); 并且它不在正文的底部,那么它可能在元素存在之前运行,因此选择器实际上不会找到元素...所以没有什么可以淡入的。您可以通过将其放置在当前代码所在的位置来查看此行为:

alert("#myID count: " + $("#myID").length); //probably alerts 0 currently

如果这不是问题...检查您的控制台是否有 javascript 错误:)

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文