jQuery代码在Google Chrome中不起作用

jQuery代码在Google Chrome中不起作用,jquery,plugins,Jquery,Plugins,我已经编写了一个简单的jQuery代码来控制ajax选项卡导航。。它在FireFox上运行良好,但在Chrome上,它在一个页面上运行,但在主页上不工作,我不知道为什么 它的代码非常简单,只是有很多动画和回调之类的东西。。代码如下: jQuery.fn.tabs = function({movieID, movieTitle}) { var tabsWrap = '#movie_details_wrap'; var tabsContent = '#tab_cont

我已经编写了一个简单的jQuery代码来控制ajax选项卡导航。。它在FireFox上运行良好,但在Chrome上,它在一个页面上运行,但在主页上不工作,我不知道为什么

它的代码非常简单,只是有很多动画和回调之类的东西。。代码如下:

jQuery.fn.tabs = function({movieID, movieTitle}) {

    var tabsWrap =      '#movie_details_wrap';
    var tabsContent =   '#tab_content';
    var firstTab =      '#tab_detalles';
    var postPHP =       'index.php?controlador=pelicula';

    //When page loads... first tab actions
    $('ul.tabs_nav a:first').addClass('active'); //Activate first tab nav

    $.get(postPHP, {"activeTab": firstTab, "movieID": movieID},
        function(response){
            $(tabsContent).html(response); // insert response into the faded out div
            $(tabsWrap).animate({ // animate the wrap div using the new container div height
                height: $(tabsContent).height() + "px"
                    }, function() {
                        $(tabsContent).fadeIn(); // fade in the div with all the info
                    });
        });

    //On Click Event
    $('ul.tabs_nav li').click(function() {

        $('ul.tabs_nav a').removeClass('active'); //Remove any 'active' class
        $(this).find('a').addClass('active'); //Add 'active' class to selected tab

        var activeTab = $(this).find('a').attr('href'); //Find the href attribute value to identify the active tab + content
        var orgHeight = $(tabsContent).height() + 'px'; // get original height

        $(tabsWrap).css('height', orgHeight); // set height with css to freeze the wrap div when we hide the inner div
        $(tabsContent).fadeOut(200, function() { // fade out the inner div
            // send data by ajax (post)
            $.get(postPHP, {"activeTab": activeTab, "movieID": movieID , "movieTitle": movieTitle},
                function(response){
                    $(tabsContent).html(response); // insert response into the faded out div
                        $(tabsWrap).animate({ // animate the wrap div using the new container div height
                            height: $(tabsContent).height() + "px"
                        }, function() {
                            $(tabsContent).fadeIn(); // fade in the div with all the info
                        });
                    });

        });

        return false;
    });
};
以下是HTML:

<script type="text/javascript">
  $(document).ready(function(){
      $('.tabs_nav').tabs({movieID:'135353', movieTitle: 'Some Title'});
  });
</script>

<!--Navigation-->                   
<ul id="details_nav" class="tabs_nav">
  <li><a href="#tab_detalles">Detalles</a></li>
  <li><a href="#tab_criticas">Criticas</a></li>
  <li><a href="#tab_posters">Posters</a></li>
  <li><a href="#tab_trailers">Trailers</a></li>
</ul>

<div class="border_wrap">
  <div id="movie_details_wrap">
    <div id="tab_content">
      <!--Tabs content here-->
    </div>
  </div>
</div>

$(文档).ready(函数(){
$('.tabs_nav').tabs({movieID:'135353',movieTitle:'Some Title'});
});
问题在于

jQuery.fn.tabs = function({movieID, movieTitle}) {
参数语法在Chrome(和IE)中是非法的。解决办法是这样做

jQuery.fn.tabs = function( properties ) {

      var movieID = properties.movieID;
      var movieTitle = properties.movieTitle;

我不知道为什么它能在firefox中工作。其他人对原因的任何评论都会很好

我遇到过一个类似的问题,在编辑CSS值时,通过引用“widget”元素($(“#元素”).tabs(“widget”))而不是元素本身解决了这个问题。

您好,谢谢您的回答!还有一个问题,我对其调整大小时的高度有问题。。我不知道为什么有些标签没问题,但有些标签只是增加了一些额外的高度。。有什么问题吗?我真的不知道。如果你再问一个问题,我想你会得到答案:)