javascript - I am getting issue on accordion click event in bootstrap -
i have created 1 page in there on button more.if click on more next page display.in next page there 5 accordion tab created..the issue accordion tab click event not working.please me..
<html> <head> <meta charset="utf-8"> <title>dummy</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1"> <meta name="format-detection" content="telephone=no"> <link href="favicon.ico" rel="shortcut icon" type="image/x-icon"> <link rel="stylesheet" href="css/style.css"> <link rel="stylesheet" href="css/responsive.css"> <link rel="stylesheet" href="css/themes.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <style> .accordion-toggle{ display:inline-block; width:100%; } </style> </head> <body class="blue-skin"> <div class="wrapper"> <!-- section --> <section id="home"> <div class="wrap inverse bg-dark vpadding-strong anima"> </div> </section> <section id="advs"> <div class="wrap"> <header class="content-header"></header> <article id="fumeexhaustsystem" class="container_12 content center"> <div class="grid_1"></div> <div class="grid_10"> <div class="grid_6"> "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." <a href="#" data-popup="work-popup-2" class="button"><span>more</span></a> </div> </div> <div class="grid_1"></div> </article> <footer class="content-footer"></footer> </div> </section> </div> <!-- /wrapper --> <div class="overlay"></div> <!-- overlay layer --> <!-- popup: portfolio --> <div id="work-popup-2" class="popup work-popup"> <a href="#" class="pclose"></a> <div class="slides-container fullslider"> <ul class="sliderwrap"> <li><div class="bgimg"><img src="images/slides/slide-3.jpg" alt=""></div></li> <li><div class="bgimg"><img src="images/slides/slide-4.jpg" alt=""></div></li> <li><div class="bgimg"><img src="images/slides/slide-5.jpg" alt=""></div></li> <li><div class="bgimg"><img src="images/slides/slide-6.jpg" alt=""></div></li> <li><div class="bgimg"><img src="images/slides/slide-9.jpg" alt=""></div></li> </ul> <a href="#" class="slide-prev slide-arrow"></a> <a href="#" class="slide-next slide-arrow"></a> </div> <div class="container_12 vpadding"> <div class="grid_3"> <h2> system</h2> </div> <div class="grid_9"> "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseone"> 1. </a><i class="indicator glyphicon glyphicon-chevron-down pull-right"></i> </h4> </div> <div id="collapseone" class="panel-collapse collapse in"> <div class="panel-body"> <p>"lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p> </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapsetwo"> 2. </a><i class="indicator glyphicon glyphicon-chevron-up pull-right"></i> </h4> </div> <div id="collapsetwo" class="panel-collapse collapse"> <div class="panel-body"> "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapsethree"> 3. </a><i class="indicator glyphicon glyphicon-chevron-up pull-right"></i> </h4> </div> <div id="collapsethree" class="panel-collapse collapse"> <div class="panel-body"> "lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapsefour"> 4. </a><i class="indicator glyphicon glyphicon-chevron-up pull-right"></i> </h4> </div> <div id="collapsefour" class="panel-collapse collapse"> <div class="panel-body"> <p>"lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p> </div> </div> </div> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapsefive"> 5. </a><i class="indicator glyphicon glyphicon-chevron-up pull-right"></i> </h4> </div> <div id="collapsefive" class="panel-collapse collapse"> <div class="panel-body"> <p>"lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."</p> </div> </div> </div> </div> <script> function togglechevron(e) { $(e.target) .prev('.panel-heading') .find("i.indicator") .toggleclass('glyphicon-chevron-down glyphicon-chevron-up'); } $('#accordion').on('hidden.bs.collapse', togglechevron); $('#accordion').on('shown.bs.collapse', togglechevron); </script> <script src="js/jquery-2.1.0.min.js"></script> <script src="js/jquery.plugins.js"></script> <script src="js/custom.js"></script> </body> </html>
what doing here collapsing div on click of anchor tag.
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseone">
and it's working fine, maybe want opened on click of whole slide, can css workaround making anchor spread on whole clickable panel.
see attached fiddle more info
updated fiddle : http://jsfiddle.net/rockrathore/f6au4bn9/3/
Comments
Post a Comment