kswedberg / jquery-expander

Expand and Collapse HTML content
https://kswedberg.github.io/jquery-expander/
Other
459 stars 168 forks source link

An option to start expanded would be useful #103

Closed adammessinger closed 8 years ago

adammessinger commented 9 years ago

A boolean option like startExpanded would be great for a use case I have. This would start the block expanded, but still allow it to be collapsed by the user.

advantgroup commented 8 years ago

+1. Especially if we can hit it with a URL.

advantgroup commented 8 years ago

BTW, you can just simulate the clicking with a #ID in the URL like so:

if (window.location.href.indexOf('#') > -1)
    var url = /#(\d+)/.exec(location.href) + '',
      id = url.split(',')[1]

      if (id)
              console.log('Clicking ID: ' + id)
              $('.pub_' + id).find('.read-more a').click()
kswedberg commented 8 years ago

Thanks for the reports. I'll try to look into this over the weekend.

kswedberg commented 8 years ago

Added startExpanded option in c9985517db26fbf138f1f609670f5ac970372998. Enjoy!