jQuery slide is jumpy

前端 未结 27 1760
悲&欢浪女
悲&欢浪女 2020-12-07 16:52

I tried to slide in and out a DIV with the toggle function of jQuery but the result is always jumpy at the start and/or end of the animation. Here\'s the js code that I use:

相关标签:
27条回答
  • 2020-12-07 17:30

    css padding and jquery slideToggle doesn't work well together. Try to box out padding.

    0 讨论(0)
  • 2020-12-07 17:31

    Try setting the 'position' property of the the container (in this case the .notice div) to 'relative'.

    Worked for me. Source: slideToggle height is "jumping"

    0 讨论(0)
  • 2020-12-07 17:33

    Try removing all CSS margins from all the elements. Usually jerky animation comes from margins not being taken into account by the animation framework.

    0 讨论(0)
  • 2020-12-07 17:33

    For me removing the min-height from my container solved the problem.

    0 讨论(0)
  • 2020-12-07 17:34

    I noticed if you have a <br /> after your container <div> the animation will also be jumpy. Removing this resolved my problem.

    0 讨论(0)
  • 2020-12-07 17:37

    The problem is that you are performing the action on the parent, doing this removes the CSS related to that element.

    You need to run the slide on your note1, not the parent of note 1.

    I had the same issue and fixed it by moving down a level.

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