javascript - slideToggle jQuery Speed - Stack Overflow

admin2025-04-19  0

  <div class='sideBar'></div>
    <ul>
        <li><a href='javascript:void(0);'></a></li>
        <li><a href='javascript:void(0);'></a></li>
    <ul>    

var $sideBar = $('.sideBar'),
    $sideBarA = $sideBar.find('a');

$sideBar.on('click', function() {
    $sideBar.children('ul').slideToggle('linear');
});

$sideBarA.on('click', function(e) {
    e.stopPropagation();
});

There is no animate control in above code, Ayah want to add below line into jQuery above..how to implement this so Ayah can control slide toggle speed. Thanks in advance!

  $('').animate(,200);
  <div class='sideBar'></div>
    <ul>
        <li><a href='javascript:void(0);'></a></li>
        <li><a href='javascript:void(0);'></a></li>
    <ul>    

var $sideBar = $('.sideBar'),
    $sideBarA = $sideBar.find('a');

$sideBar.on('click', function() {
    $sideBar.children('ul').slideToggle('linear');
});

$sideBarA.on('click', function(e) {
    e.stopPropagation();
});

There is no animate control in above code, Ayah want to add below line into jQuery above..how to implement this so Ayah can control slide toggle speed. Thanks in advance!

  $('').animate(,200);
Share Improve this question asked Nov 28, 2014 at 9:08 ayahayah 231 silver badge5 bronze badges 2
  • 2 Why is Ayah talking in the third person? – Alex Commented Nov 28, 2014 at 9:10
  • Ayah could provide 'normal' or 'slow' or 'fast' to slideToggle like this: slideToggle("slow") :) – Abhitalks Commented Nov 28, 2014 at 9:10
Add a ment  | 

1 Answer 1

Reset to default 4

Just add the speed:

$sideBar.on('click', function() {
    $sideBar.children('ul').slideToggle('500','linear');
});
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745075590a283547.html

最新回复(0)