jQuery的code在Chrome而不是Firefox中工作 [英] Jquery code working in Chrome but not in Firefox

查看:86
本文介绍了jQuery的code在Chrome而不是Firefox中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这块code的,揭示了几个div被点击时,然后他们被隐藏,一旦另一个链接被点击。我试图让这个在Firefox中显示,它可能不是在js一个问题,但所有的帮助是很大的AP preciated。

I have this piece of code that reveals a couple of divs when it is clicked and then they are hidden once another link is clicked. I'm trying to get this to show in Firefox and it may not be a problem in the js but all help is greatly appreciated.

<script type="text/javascript">
    $(document).ready(function(){
            $('.fadein').click(function(){
                    // Make the id overview show
                    $('#header-contact').hide('slow'); 
                    $('#header-portfolio').show('slow');
                    $('#content-portfolio').show('slow');
                    // override default a behavior
                    return false;
            });
    });
</script>
<script type="text/javascript">
    $(document).ready(function(){
            $('.fadein2').click(function(){
                    // Make the id overview show
                    $('#header-portfolio').hide('slow');                       
                    $('#header-contact').show('slow');
                    $('#content-portfolio').hide('slow');
                    // override default a behavior
                    return false;
            });
    });

</script>
<script type="text/javascript">
    $(document).ready(function(){
            $('.fadein3').click(function(){
                    // Make the id overview show
                    $('#header-portfolio').hide('slow');                       
                    $('#header-contact').hide('slow');
                    $('#content-portfolio').hide('slow');
                    // override default a behavior
                    return false;
            });
    });

推荐答案

尝试通过了事件每个点击处理程序和你以前返回false ,电话 preventDefault()对传入的事件对象。

Try passing the event to each of the click handlers and before you return false, call preventDefault() on the passed-in event object.

例如:

$(document).ready(function(){
        $('.fadeinX').click(function(e){
                // Make the id overview show
                $('#header-portfolio').hide('slow');                       
                $('#header-contact').hide('slow');
                $('#content-portfolio').hide('slow');
                // override default a behavior
                e.preventDefault();
                return false;
        });
});

这篇关于jQuery的code在Chrome而不是Firefox中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆