시뮬레이션 시나닷컴 웨이보의'다들 말하는'자바스크립트.

전에 인터넷에서 이미 만들어진 것을 찾으려고 했지만 찾지 못하고 스스로 하나 썼다.여러분에게 참고를 제공하니, 더 좋은 것이 있으면 의견을 제시해 주십시오.
 
html:
 
  • 1
  • 2
  • 3
  • 4

 
초기화:
$(function(){
    /*
    * discription: doing section for li roundabout
    */
    roundabout.move(4000);


    //on over div#doing stop flash.
    roundabout.mstop('#doing');

})




:

/* * author: teresa 2010-12-31 * description: roundabout object roundabout.move(time) : start move; roundabout.stop(): stop ; roundabout.mstop(obj): when mouseover obj stop roundabout & mouseout restart roundabout. */ var roundabout = { //index : 0, move: function(time){ //move roundabout.o = $('#doing ul li'); var height = roundabout.o.last().height(); roundabout.inter = setInterval("roundabout_event();fade_in("+height+");",time); }, stop: function(){ //stop roundabout.inter = clearInterval(roundabout.inter); }, mstop: function(o){ $(o).mouseover(function(){ roundabout.stop(); }).mouseout(function(){ roundabout.move(4000); }) } } function roundabout_event(){ var o = $('#doing ul li'); o.last().clone(true).insertBefore(o.first()); } function fade_in() { var o = $('#doing ul li'); //return; var h = o.last().height(); o.first().css({height:'0',opacity:'0',overflow:'hidden'}); o.first().animate({height:h},1000); o.first().animate({opacity:'1'},500); o.last().detach(); }

좋은 웹페이지 즐겨찾기