Scriptaculous 下拉菜单在视图/显示中不起作用

发布于 2024-08-13 01:03:17 字数 664 浏览 3 评论 0原文

我对 Ruby on Rails 和 javascript 的了解还很初级,所以如果这个问题有一个简单的答案,请原谅我。我有一个网站需要多级下拉菜单。我已经改编了脚本下拉菜单,该菜单正在使用 mongrel 在我的网站的测试副本上工作。有几个页面,每个页面都有自己的布局。当我从一个页面跳转到另一个页面时,下拉菜单工作正常,但是当我进入任何“查看/显示”页面时,只有第一级菜单工作。我怀疑跳转到显示会以某种方式丢失 JavaScript。任何人都知道如何解决这个问题。在我所有的布局头中,我有以下内容:-

<%= stylesheet_link_tag 'style' %>
<%= javascript_include_tag :defaults %>
<script src="javascripts/prototype.js" type="text/javascript"></script>
<script src="javascripts/scriptaculous.js" type="text/javascript"></script>
<script type='text/javascript' src='javascripts/menu.js'></script>

我正在使用 Scriptaculous 下载附带的原型、控件等。

My knowledge of Ruby on Rails and javascript is rudimentary so please forgive me if this question has a simple answer. I have a website that needs a multi level dropdown menu. I have adapted scriptalculous drop down menu which is working on a test copy of my website using mongrel. There are several pages each with its own layout. When I jump from page to page the drop down menu works fine, but when I go to any "view/show" page only the first level menu works. I suspect that jumping to show loses the javascript somehow. Anybody knows how to solve this problem. In all my layout head I have the following:-

<%= stylesheet_link_tag 'style' %>
<%= javascript_include_tag :defaults %>
<script src="javascripts/prototype.js" type="text/javascript"></script>
<script src="javascripts/scriptaculous.js" type="text/javascript"></script>
<script type='text/javascript' src='javascripts/menu.js'></script>

I am using the protype, controls etc that came with Scriptaculous download.

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

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

发布评论

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

评论(1

悲歌长辞 2024-08-20 01:03:17

听起来您的问题很可能不在您的问题中包含的短代码片段之内。

您是否使用 Firebug 检查过菜单是否正确构建和发送,是否包含所有需要的文件, ETC。? (甚至可能不是 JavaScript 问题)

还有很多其他可能性,但很难从提供的代码中确定。

鉴于您网站中的其他页面都有工作菜单,并且大概跨页面的菜单是相同的(我猜是导航菜单),那么标记或 javascript 文件很可能是不同的(未封闭的标签、丢失的标签) ,带有显示的内联CSS:无等)

sounds most likely that your problem lies outside of the short code snippet included in your question.

Have you checked with Firebug to see if the menu is being built and sent appropriately, that all of the needed files are included, etc.? (might not even be a javascript issue)

There are lots of other possibilities but it's rather hard to determine from the code provided.

Given that the other pages in your site have working menus, and presumably the menu is the same across pages (navigation menu, I'd guess), then it is extremely likely that the markup or javascript files are different (unclosed tags, missing tags, inline css with display:none, etc)

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