Jquery's fadein 'slow' is too fast

后端 未结 4 751
旧时难觅i
旧时难觅i 2020-12-29 04:29

i\'m using the jquery fadein fadeout with the slow option, but it\'s still a little too fast for me. now i\'ve read that you can only choose between fast and slow, but is th

相关标签:
4条回答
  • 2020-12-29 05:03

    You have two options. The first is to use a number of milliseconds in the call:

    $('#myItem').fadeOut(1500); // 1.5 seconds
    

    The second option is to define a custom speed, or to redefine a jQuery native speed:

    $.fx.speeds.slow = 1500; // 'slow' now means 1.5 seconds
    $.fx.speeds.xslow = 3000; // 'xslow' means 3 seconds
    $.fx.speeds.xfast = 100; // 'xfast' means 0.1 seconds
    

    You can then call them as normal:

    $('#myItem').fadeOut('slow');
    $('#myItem').fadeOut('xslow');
    $('#myItem').fadeOut('xfast');
    

    This allows you to redefine speeds on an application-wide basis.

    0 讨论(0)
  • 2020-12-29 05:04

    Use a number of milliseconds rather than 'fast' or 'slow'

    e.g.

    $('#myID').fadeIn(100, function() {
      // complete
    });
    

    See http://api.jquery.com/fadeIn/

    0 讨论(0)
  • 2020-12-29 05:11

    In addition to 'slow'/'fast', the fadeIn function also takes a timespan in milliseconds so you can make it take however long you want:

    $('#someId').fadeIn(3000); // 3 second fade in
    
    0 讨论(0)
  • 2020-12-29 05:14

    I really dont know how slow you want it but I recoomend something between 2500-4000

    $('#Id').fadeIn(3500);
    

    There we go

    0 讨论(0)
提交回复
热议问题