本文介绍了淡入/淡出LI并调整容器的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下标记(我在代码笔中创建了):

I have the following markup (I created an example in Code Pen):

 

Make sure the links have the same ID as their <li> items for this to work

< a href = < #S1class =currentStoryid =S1> 1< / a>
< a href =#S2id = S2> 2< / a>

$(document).ready(function() {

  function swapStory(storyName){
$('.slider li.currentStory').hide();
$('.slider li.currentStory').removeClass('currentStory');
$('.slider [id = ' + storyName + ']').addClass('currentStory');
$('.slider [id = ' + storyName + ']').fadeIn("slow");
  }

  $(function() {

     $('.slider li:not(".currentStory")').hide();
        $('.slider a').click(function(){
            swapStory($(this).attr("id"));
            return(false);
        });
   });

});

希望这是您正在寻找的内容。

Hope this is what you are looking for.

这篇关于淡入/淡出LI并调整容器的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 13:51