danielstocks / jQuery-Collapse

A lightweight (~1kb) jQuery plugin that enables expanding and collapsing content
http://webcloud.se/jQuery-Collapse/
MIT License
679 stars 153 forks source link

Document/Example conflict on the use of open/close show/hide #90

Closed whatsnewsisyphus closed 7 years ago

whatsnewsisyphus commented 7 years ago

Hello, The example on the page uses open/close to scrollup/scrolldown the collapsible container, while the document suggests using show/hide.

Using show hide methods as suggested in the readme does not scroll up / down, probably because the open close methods get to display:none / display:block first.

What would be the correct way to make it scroll up/down?

danielstocks commented 7 years ago

Are you talking about this page? http://webcloud.se/jQuery-Collapse/ And if so, are you talking about the CSS3 Animations?

whatsnewsisyphus commented 7 years ago

Hello Daniel, I mean that in the custom show/hide, it uses the following

new jQueryCollapse($("#custom-show-hide-example"), {
  open: function() {
    this.slideDown(150);
  },
  close: function() {
    this.slideUp(150);
  }
});

and in the README.MD in github, it uses the following which doesn't work

$("#demo").collapse({
  show: function() {
    this.slideDown(100);
  },
  hide: function() {
    this.slideUp(100);
  },
});
danielstocks commented 7 years ago

Where did you find the second code example? There are no show and hide methods in the collapse API, only open and close. The correct code should be like this:

$("#demo").collapse({
  open: function() {
    this.slideDown(100);
  },
  close: function() {
    this.slideUp(100);
  }
});
danielstocks commented 7 years ago

Ok i see what happened now, you followed an old link to an old version of the API, which used to have show, hide methods.

I will update the link to point to the latest version of README

Thanks for your feedback

whatsnewsisyphus commented 7 years ago

I found out what happened, it was a link to an old version of your readme where you used the show and hide. *edit. you figured it out as well