【发布时间】:2013-12-29 15:32:12
【问题描述】:
我为客户创建了一个页面,我最初在 Chrome 中工作,但忘记检查它是否在 Firefox 中工作。现在,我遇到了一个大问题,因为整个页面是基于一个在 Firefox 中不起作用的脚本。
它基于所有具有rel 的“链接”,从而导致隐藏和显示正确的页面。我不明白为什么这在 Firefox 中不起作用。
例如页面的 id 为 #menuPage、#aboutPage 等等。所有链接都有这个代码:
<a class="menuOption" rel='#homePage' href="#">Velkommen</a>
它在 Chrome 和 Safari 中完美运行。
代码如下:
$(document).ready(function(){
//Main Navigation
$('.menuOption').click(function(){
event.preventDefault();
var categories = $(this).attr('rel');
$('.pages').hide();
$(categories).fadeIn();
});
// HIDES and showes the right starting menu
$('.all').hide();
$('.pizza').show();
// Hides and shows using rel tags in the buttons
$('.menyCat').click(function(event){
event.preventDefault();
var categori = $(this).attr('rel');
$('.all').hide();
$(categori).fadeIn();
$('html,body').scrollTo(0, categori);
});
});
【问题讨论】:
-
如果您在说“不起作用”时能准确解释您的意思,那将非常有帮助。 会发生什么?错误?布局不好?不良行为?
标签: javascript jquery html firefox