当前位置: 代码迷 >> Java Web开发 >> 有没有帮小弟我看看这2段js,哪里有冲突吗
  详细解决方案

有没有帮小弟我看看这2段js,哪里有冲突吗

热度:5705   发布时间:2013-02-25 21:14:24.0
有没有帮我看看这2段js,哪里有冲突吗
$(function() {

  // Set up variables
  var $el, $parentWrap, $otherWrap, 
  $allTitles = $("dt").css({
  "cursor": "pointer" // make it seem clickable
  }),
  $allCells = $("dd").css({
  position: "relative",
  top: -1,
  left: 0,
  display: "none" // info cells are just kicked off the page with CSS (for accessibility)
  });
   
  // clicking image of inactive column just opens column, doesn't go to link  
  $("#page-wrap").delegate("a","click", function(xx) { 
   
  if ( !$(this).parent().hasClass("curCol") ) {  
  xx.preventDefault(); 
  $(this).next().find('dt:first').click(); 
  } 
   
  });
   
  // clicking on titles does stuff
  $("#services").delegate("dt", "click", function() {
   
  // cache this, as always, is good form
  $el = $(this);
   
  // if this is already the active cell, don't do anything
  if (!$el.hasClass("current")) {
   
  $parentWrap = $el.parent().parent();
  $otherWraps = $(".info-col").not($parentWrap);
   
  // remove current cell from selection of all cells
  $allTitles = $("dt").not(this);
   
  // close all info cells
  $allCells.slideUp();
   
  // return all titles (except current one) to normal size
  $allTitles.animate({
  fontSize: "14px",
  paddingTop: 0,
  paddingBottom: 0
  });
   
  // animate current title to larger size  
  $el.animate({
  "font-size": "20px",
  paddingTop: 5,
  paddingBottom: 5
  }).next().slideDown();
   
  // make the current column the large size
  $parentWrap.animate({
  width: 310
  }).addClass("curCol");
   
  // make other columns the small size
  $otherWraps.animate({
  width: 190
  }).removeClass("curCol");
   
  // make sure the correct column is current
  $allTitles.removeClass("current");
  $el.addClass("current");  
   
  } else {
$allCells.slideUp();
$el.animate({
fontSize: "14px",
paddingTop: 0,
paddingBottom: 0
});
$parentWrap.animate({
width: 220
}).removeClass("curCol");
$otherWraps.animate({
width: 220
}).removeClass("curCol");
$el.removeClass("current");
  }
   
  });
   
  $("#starter").trigger("click");
  相关解决方案