0

我还是 jquery 的新手,可以在这里使用一些帮助 :-) 当我在 Chrome 中离线时,此代码有效,一旦我尝试在 IE9 或 Firefox 中使用它,它将无法工作。所以我上传了该网站,现在它甚至无法在 Chrome 中运行。

我在 Firefox 和 IE 中收到一条错误消息,告诉我“未定义事件”第 8 行 --> event.preventDefault();

会是什么?错误的链接?在 html 中,它们是这样添加的:

问题解决了这条线解决了问题:

 $('.hidden_nav ul li a').click(function(event){
                event.preventDefault();

这是函数(事件)。我留下了一个空函数()

谢谢大家

$(document).ready(function(){
        //Get size of docuement and apply to div grid

        var height = $(document).height();
        $('.theGrid').css('height',height);

        // Slide Down hidden Content
        $('.hidden_nav li a').click(function(){
                event.preventDefault();
                var selected = $(this).text().toLowerCase();
                var thisone = $('#'+ selected);

                $('.hidden_content').slideDown(200);
                thisone.slideDown(200);
                thisone.addClass('online')
                $('.bubble').fadeIn(100).delay(2000).hide(300);

            });

            $('.close_btn').click(function(){
                $('.hidden_content').slideUp(200);
                $('.online').hide().removeClass('.online');
                $('.bubble').hide();

            });

        //Design Process // a few $ animations
        $('.step_img').mouseover(function(){
            var sel = $(this).next('h4').text().toLowerCase();
                thisone = $('#' + sel);
                thisone.children('p').slideDown(100);
        });
       $('.step_img').mouseout(function(){
            var sel = $(this).next('h4').text().toLowerCase();
                thisone = $('#' + sel);
                thisone.children('p').delay(1000).slideUp(400);
        });


        // Slider  (Nivo Slider Plugin) effects
         $('.slider').nivoSlider({
                effect:'random',
                startSlide:2,
                directionNav: true,
                pauseOnHover: true,
                pauseTime: 6000,
            });
    });
4

1 回答 1

0

仔细检查您的文件是否正确加载了 jquery 库。如果您在本地使用相对路径,请确保它们在服务器上相同。

于 2012-06-14T00:26:46.547 回答