Basic jQuery slideUp and slideDown driving me mad!

后端 未结 10 777
情深已故
情深已故 2020-12-09 19:06

my jQuery skills are pretty good normally but this is driving me mad!

It\'s a fairly simple accordian I\'ve coded up from scratch. Using jQuery 1.3.2 so there should

相关标签:
10条回答
  • 2020-12-09 20:05

    Replacing margin-top and margin-bottom values with padding-top and padding-bottom values did the trick for me. Don't forget to set the margin value to 0 after this.

    0 讨论(0)
  • 2020-12-09 20:05

    For me, the problem was the margin (or padding) on the div to show/hide with slide, but I needed to give margin (or padding) to that div. I solved with this trick:

      .slide-div:before{
        content: " ";
        display: block;
        margin-top: 15px;
      }
    
    0 讨论(0)
  • 2020-12-09 20:07

    I also had an annoying slideUp() jump issue that occurred on Safari, but not chrome or IE. It turned out that the div tag I was hiding/showing was right below another div tag that contained float:left divs. During sliding up, the floating divs would be momentarily re-rendered causing the jump.

    The fix was simply adding clear:both to the style of the hiding/showing div.

    0 讨论(0)
  • 2020-12-09 20:11

    This worked for me:

    $(this).pathtoslidingelementhere.width($(this).parent().width());
    
    0 讨论(0)
提交回复
热议问题