scroll - CSS - Can't get overflow:hidden to work when overflowing on right or bottom -


i have created template contains panel , content. depending on template's class (top, left, right, or bottom) panel have different position. expand , collapse animations performed using transition , classes.

edit: here fiddle: http://jsfiddle.net/ckkvx/2/ /edit

here html code:

<!doctype html> <html>     <head>         <link href="../css/reset.dev.css" type="text/css" rel="stylesheet">         <link href="../css/v_paneltemplate.dev.css" type="text/css" rel="stylesheet">         <script src="../js/jquery-1.9.1.min.js" type="text/javascript">         <script src="../js/v_paneltemplate.dev.js" type="text/javascript">     </head>     <body class="paneltemplate bottom">         <div class="panel autohide collapsed">panel</div>         <div class="content expanded">content</div>     </body> </html> 

and here css code:

#charset "utf-8";  .paneltemplate {     position: absolute;     top: 0;     left: 0;     right: 0;     bottom: 0;     overflow: hidden;     } .paneltemplate > .panel, .paneltemplate > .content {     position: absolute;     -webkit-transition: ease-in-out 400ms;        -moz-transition: ease-in-out 400ms;         -ms-transition: ease-in-out 400ms;          -o-transition: ease-in-out 400ms;             transition: ease-in-out 400ms;     } .paneltemplate.top > .panel, .paneltemplate.bottom > .panel {     height: 100px;     left: 0;     right: 0;     } .paneltemplate.left > .panel, .paneltemplate.right > .panel {     width: 200px;     top: 0;     bottom: 0;     } .paneltemplate.top > .content, .paneltemplate.bottom > .content {     left: 0;     right: 0;     } .paneltemplate.left > .content, .paneltemplate.right > .content {     top: 0;     bottom: 0;     } .paneltemplate.top > .panel {     top: -90px;     } .paneltemplate.left > .panel {     left: -190px;     } .paneltemplate.right > .panel {     right: -190px;     } .paneltemplate.bottom > .panel {     bottom: -90px;     } .paneltemplate.top > .panel.expanded {     top: 0;     } .paneltemplate.left > .panel.expanded {     left: 0;     } .paneltemplate.right > .panel.expanded {     right: 0;     } .paneltemplate.bottom > .panel.expanded {     bottom: 0;     } .paneltemplate.top > .content {     top: 100px;     bottom: 0;     } .paneltemplate.left > .content {     left: 200px;     right: 0;     } .paneltemplate.right > .content {     right: 200px;     left: 0;     } .paneltemplate.bottom > .content {     bottom: 100px;     top: 0;     } .paneltemplate.top > .content.expanded {     top: 10px;     } .paneltemplate.left > .content.expanded {     left: 10px;     } .paneltemplate.right > .content.expanded {     right: 10px;     } .paneltemplate.bottom > .content.expanded {     bottom: 10px;     } /* test css */ .paneltemplate > .panel {     background: #777;     color: #fff;     } .paneltemplate > .content {     background: #333;     color: #fff;     } 

and, if needed, javascript code:

(function($) {      $(document).ready(function() {          var close_delay = 1000;          var $panel = $('.paneltemplate > .panel.autohide').first();             $content = $('.paneltemplate > .content').first();          $panel.mouseenter(function() {             $panel               .addclass('expanded')               .removeclass('collapsed')               .data('ismouseover', true);             $content               .removeclass('expanded')               .addclass('collapsed');         }).mouseleave(function() {             $panel.data('ismouseover', false);             // waiting short time in case mouse accidently leaves             var timeout = settimeout(function() {                 // if it's no longer on after time out, closing                 if( ! $panel.data('ismouseover')) {                     $panel                       .removeclass('expanded')                       .addclass('collapsed');                     $content                       .addclass('expanded')                       .removeclass('collapsed');                 }                 cleartimeout(timeout);             }, close_delay);         });     }); })(jquery); 

when i'm using classes top or left on template, works intended, when use either right or bottom, panel, while moving out of body, expends window , causes scroll bars appear.

i read in question related overflow:hidden due relatively positioned element, don't have any. tried position html tag , add overflow:hidden too, didn't either.

what can prevent ?

this should fix issue-

body {     max-width:100%; } 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -