使用转换函数时,如何使div元素淡出变慢

时间:2017-03-03 15:32:34

标签: javascript jquery css

使用过渡函数

时,如何使div元素淡出变慢

$('.masthead').visibility({
  once: false,
  onBottomPassed: function() {
    $('.fixed.menu').transition('fade in');
    $('.fixed.menu').animate({
      height: 80
    }, 500); //animate the menu to the width of 80
  },
  onBottomPassedReverse: function() {
    $('.fixed.menu').animate({
      height: 50
    }, 500); //animate the menu back to the original width
    $('.fixed.menu').transition('fade out');
  }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<div class="masthead">
<div id="fixed-menu">
</div>

</div>

1 个答案:

答案 0 :(得分:0)

您可以使用jQuery fadeIn()和fadeOut()

$(".fixed.menu").fadeIn("slow");

$(".fixed.menu").fadeOut("slow");