javascript - Open url/file when clicking bootstrap accordion -
i need twitter's bootstrap accordion. need when click accordion title, title opens href to.
<div class="container"> <p class="max-width-700 lead">testing</p> <div class="col-md-6 col-sm-6 mb-sm-30"> <div class="accordion"> <div class="accordion-title"> <a href="">2014 (opening)</a> </div> <div class="accordion-title"> <a href="">2015 </a> </div> <div class="accordion-content"> </div>
something this, when click 2014, opens document or file have linked to
(1) use boostrap-collapse.js
event. see http://getbootstrap.com/2.3.2/javascript.html#collapse
give each title unique id , add following js end of html.
$('#myitem1').on('show', function () { window.location.href = '1.0.pdf'; })
(2) accordion designed open underlying hidden content. using open external files not expected behaviour - recommend not using type of ux - users see clickbait.
(3) .accordion
class comes boostrap 2(?) 2 no longer supported.
Comments
Post a Comment