Fixed left and right menu middle content should be scrollable, not working

I am trying left and right fixed position menu with in responsive way I tried below code when I put attribut "data-spy=“affix” and class “scrollspy” then it behave something weird, I need my both left and right menu should be fixed only middle content need to be scrollable, and in full responsive way…

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
		<script type='text/javascript' src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
        <script type='text/javascrist' src="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
        
        <!--[if lt IE 9]>
          <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->

    </head>
    <body>
    

    <div class="container">
      <div class="row row-offcanvas row-offcanvas-left">
          <div class="row-offcanvas row-offcanvas-right">
             <div class="col-xs-6 col-sm-2 sidebar-offcanvas scrollspy" id="sidebarLeft" role="navigation">
               <p class="visible-xs">
                <button class="btn btn-primary btn-xs" type="button" data-toggle="offcanvas"><i class="glyphicon glyphicon-chevron-left"></i></button>
              </p>
              <div class="well sidebar-nav">
                <ul class="nav" data-spy="affix">
                  <li>Left Sidebar</li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                </ul>
              </div><!--/.well -->
            </div><!--/span-->
            
            <div class="col-xs-12 col-sm-8">
              <p class="pull-left visible-xs">
                <button class="btn btn-primary btn-xs" type="button" data-toggle="offcanvas"><i class="glyphicon glyphicon-chevron-left"></i></button>
              </p>
              <p class="pull-right visible-xs">
                <button class="btn btn-primary btn-xs" type="button" data-toggle="offcanvasright"><i class="glyphicon glyphicon-chevron-right"></i></button>
              </p>
              <div class="jumbotron">
                <h1>Hello, world!</h1>
                <p>This is an example to show the potential of an offcanvas layout pattern in Bootstrap. Try some responsive-range viewport sizes to see it in action.</p>
              </div>
              <div class="row">
                <div class="col-6 col-sm-6 col-lg-4">
                  <h2>Heading</h2>
                  <p>Bootstrap is a front-end framework that uses CSS and JavaScript to facilitate responsive Web design. Bootply is a playground for Bootstrap that enables developers and designers to test, prototype and create mockups using Bootstrap friendly HTML, CSS and Javascript.</p>
                  <p><a class="btn btn-default" href="#">View details ۼ/a></p>
                </div><!--/span-->
                <div class="col-sm-6 col-lg-4">
                  <h2>Heading</h2>
                  <p>Bootply is a playground for Bootstrap that enables developers and designers to test, prototype and create mockups using Bootstrap friendly HTML, CSS and Javascript. Bootstrap is a front-end framework that uses CSS and JavaScript to facilitate responsive Web design. </p>
                  <p><a class="btn btn-default" href="#">View details ۼ/a></p>
                </div><!--/span-->
                <div class="col-sm-6 col-lg-4">
                  <h2>Heading</h2>
                  <p>Bootstrap is a front-end framework that uses CSS and JavaScript to facilitate responsive Web design. Bootply is a playground for Bootstrap that enables developers and designers to test, prototype and create mockups using Bootstrap friendly HTML, CSS and Javascript.</p>
                  <p><a class="btn btn-default" href="#">View details ۼ/a></p>
                </div><!--/span-->
                <div class="col-sm-6 col-lg-4">
                  <h2>Heading</h2>
                  <p>Donec id elit non mi porta gravida at eget metus. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Donec sed odio dui. </p>
                  <p><a class="btn btn-default" href="#">View details ۼ/a></p>
                </div><!--/span-->
                <div class="col-sm-6 col-lg-4">
                  <h2>Heading</h2>
                  <p>Bootstrap is a front-end framework that uses CSS and JavaScript to facilitate responsive Web design. Bootply is a playground for Bootstrap that enables developers and designers to test, prototype and create mockups using Bootstrap friendly HTML, CSS and Javascript.</p>
                  <p><a class="btn btn-default" href="#">View details ۼ/a></p>
                </div><!--/span-->
                <div class="col-sm-6 col-lg-4">
                  <h2>Heading</h2>
                  <p>Bootstrap is a front-end framework that uses CSS and JavaScript to facilitate responsive Web design. Bootply is a playground for Bootstrap that enables developers and designers to test, prototype and create mockups using Bootstrap friendly HTML, CSS and Javascript.</p>
                  <p><a class="btn btn-default" href="#">View details ۼ/a></p>
                </div><!--/span-->
              </div><!--/row-->
            </div><!--/span-->
    
            <div class="col-xs-6 col-sm-2 sidebar-offcanvas" id="sidebarRight" role="navigation">
               <p class="visible-xs">
                <button class="btn btn-primary btn-xs" type="button" data-toggle="offcanvas"><i class="glyphicon glyphicon-chevron-left"></i></button>
              </p>
              <div class="well sidebar-nav">
                <ul class="nav">
                  <li>Right Sidebar</li>
                  <li class="active"><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                  <li>Sidebar</li>
                  <li><a href="#">Link</a></li>
                  <li><a href="#">Link</a></li>
                </ul>
              </div><!--/.well -->
            </div><!--/span-->
          
        </div>

      </div><!--/row-->
        
      <hr>
        
      <footer>
        <p>ɠCompany 2013</p>
      </footer>
 
    </div><!--/.container-->
 
        
        <script type='text/javascript'>
			$(document).ready(function() {
			
				$('[data-toggle=offcanvas]').click(function() {
				  $('.row-offcanvas-left').toggleClass('active');
				});

				$('[data-toggle=offcanvasright]').click(function() {
				  $('.row-offcanvas-right').toggleClass('active');
				});
			
			});
        
        </script>
		
		
		<style>
			body {
  padding-top: 70px;
}
footer {
  padding-left: 15px;
  padding-right: 15px;
}

/*
 * Off Canvas
 * --------------------------------------------------
 */
@media screen and (max-width: 768px) {

	
  .row-offcanvas {
    position: relative;
    -webkit-transition: all 0.4s ease-out;
    -moz-transition: all 0.4s ease-out;
    transition: all 0.4s ease-out;
  }

  .row-offcanvas-left
  #sidebarLeft {
    left: -40%;
  }

  .row-offcanvas-left.active {
    left: 40%;
  }
 
  .row-offcanvas-right 
  #sidebarRight {
    right: -40%;
  }

  .row-offcanvas-right.active {
    right: 40%;
  }

  .sidebar-offcanvas {
    position: absolute;
    top: 0;
    width: 40%;
    margin-left: 10px;
  }
}
		</style>
        
       
    </body>
</html>

The first step is to validate your code.

Can’t you just use position: fixed?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.