Want to use a scrollspy with pagination in Bootstrap -


like title says want use scrollspy pagination in bootstrap, activate.bs.scrollspy does't seems work.

here html code

<!doctype html> <html lang="en">   <head>     <meta charset="utf-8">     <meta http-equiv="x-ua-compatible" content="ie=edge">     <meta name="viewport" content="width=device-width, initial-scale=1">     <title>starter template bootstrap</title>      <!-- bootstrap core css -->     <link href="../bootstrap-3.3.5-dist/css/bootstrap.min.css" rel="stylesheet">      <style>   body {       position: relative;    }   #section1 {padding-top:50px;height:500px;color: #fff; background-color: #1e88e5;}   #section2 {padding-top:50px;height:500px;color: #fff; background-color: #673ab7;}   #section3 {padding-top:50px;height:500px;color: #fff; background-color: #ff9800;}    </style>   </head>    <body data-spy="scroll" data-target=".navbar-fixed-bottom" data-offset="50">      <nav class="navbar-fixed-bottom">       <ul class="pagination">         <li><a href="#section1">1</a></li>         <li><a href="#section2">2</a></li>         <li><a href="#section3">3</a></li>       </ul>     </nav>      <div class="container">         <div id="section1" class="container-fluid">           <h1>section 1</h1>           <p>try scroll section , @ navigation bar while scrolling! try scroll section , @ navigation bar while scrolling!</p>           <p>try scroll section , @ navigation bar while scrolling! try scroll section , @ navigation bar while scrolling!</p>         </div>         <div id="section2" class="container-fluid">           <h1>section 2</h1>           <p>try scroll section , @ navigation bar while scrolling! try scroll section , @ navigation bar while scrolling!</p>           <p>try scroll section , @ navigation bar while scrolling! try scroll section , @ navigation bar while scrolling!</p>         </div>         <div id="section3" class="container-fluid">           <h1>section 3</h1>           <p>try scroll section , @ navigation bar while scrolling! try scroll section , @ navigation bar while scrolling!</p>           <p>try scroll section , @ navigation bar while scrolling! try scroll section , @ navigation bar while scrolling!</p>         </div>      </div>      <script src="../jquery/jquery-2.1.4.min.js"></script>     <script src="../bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>     <script type="text/javascript">       $('.navbar-fixed-bottom').on('activate.bs.scrollspy', function () {         alert("rg");       });     </script>   </body> </html> 

bootstrap says scrollspy works nav, , pagination nav, why? way make work?

thanks in advance.

put class ".nav" on pager ul, it's hardcoded in plugin constructor searches "target (which .navbar-fixed-bottom) + .nav li > "

function scrollspy(element, options) { ... this.selector       = (this.options.target || '') + ' .nav li > a' ... 

so it'll give ".navbar-fixed-bottom .nav li>a"

working demo


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -