CSS3 equivalent to jQuery slideUp and slideDown?

前端 未结 10 1120
没有蜡笔的小新
没有蜡笔的小新 2020-12-04 08:12

My application is performing poorly with jQuery\'s slideDown and slideUp. I\'m looking to use a CSS3 equivalent in browsers which support it.

Is it possible, using C

10条回答
  •  一向
    一向 (楼主)
    2020-12-04 08:51

    I would recommend using the jQuery Transit Plugin which uses the CSS3 transform property, which works great on mobile devices due to the fact that most support hardware acceleration to give that native look and feel.

    JS Fiddle Example

    HTML:

    Javascript:

    $(".moveUp").on("click", function() {
        $(".moveMe").transition({ y: '-=5' });
    });
    
    $(".moveDown").on("click", function() {
        $(".moveMe").transition({ y: '+=5' });
    });
    
    $(".setUp").on("click", function() {
        $(".moveMe").transition({ y: '0px' });
    });
    
    $(".setDown").on("click", function() {
        $(".moveMe").transition({ y: '200px' });
    });
    

提交回复
热议问题