开发者

jQuery accordion 'stutters' on load, but then behaves pretty normally

I'm using a jQuery accordion as a website (site link). The first panel opens on load, and when it does, it stutters for a bit, but then behaves, for the most part, pretty normally.

Here's the <head> portion:

开发者_开发技巧
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/accordion.css" />
<link rel="stylesheet" type="text/css" href="css/grid.css" />
<link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
<script language="javascript" type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery.msAccordion.js"></script>

<title>Accordion</title>

<script type="text/javascript">
 $(function() {
$(".image").click(function() {
var image = $(this).attr("rel");
$('#image').hide();
$('#image').fadeIn('slow');
$('#image').html('<img src="' + image + '"/>');
return false;
    });
});
</script>

</head>

The other jQuery script is for a simple gallery.

So, the question: How do I keep this from happening?


I'd try it like this first and see how that works. I'm not seeing much of a stutter in chrome though.

$(document).ready(function() {
   $(".image").click(function() {
      var image = $(this).attr("rel");
      $('#image').hide();
      $('#image').fadeIn('slow');
      $('#image').html('<img src="' + image + '"/>');
      return false;
    });
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜