What type of animation does StackOverflow use for

2019-02-25 14:14发布

问题:

Does anyone know what type of (jQuery?) animation does Stackoverflow use for its Tag popup? By Tag popup I mean when you hover over a Tag in Stackoveflow a popup appears, the animation starts from top left to bottom right, does anyone know which type of animation it uses?

回答1:

.show( time ) method

jsBin demo

$('a.post-tag').hover(function(){

  var $this = $(this);
  var offset = $this.offset(); 
  var myPos = {X: offset.left, Y:offset.top+26}; 
  $('#tag-menu').css({left:myPos.X, top:myPos.Y, width:300, height:200}).show(400);
                                                                       // ^^^TADA !!

}, function(){

  $('#tag-menu').stop(1,1).hide();

});