ulfben

Self-adjusting fixed width

Apr 1st, 2012
529
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*Using JavaScript to keep the "fixed" page width in sync with browser size and orientation changes.
  2. Try rotating your phone or resizing the browser window here; http://www.gotlandindies.org/ */
  3.  
  4. jQuery(document).ready(function() {                    
  5.     var waiting = false;
  6.     function wait(){
  7.         if(waiting){
  8.             clearTimeout(waiting);
  9.             waiting = false;
  10.         }
  11.         waiting = setTimeout(doScale, 100); //a delay to avoid duplicate event calls.  
  12.     }
  13.     function doScale(){
  14.         var w = jQuery(window).width();
  15.         //if(w < 1024){ w = 1024; }
  16.         jQuery('.container').animate({
  17.                 width:w+'px'
  18.             }, 800, function(){
  19.                 jQuery('.container').css('overflow', 'hidden');
  20.             }
  21.         );
  22.     }
  23.     jQuery(window).bind('orientationchange', wait);
  24.     jQuery(window).bind('resize', wait);
  25. });
Advertisement
Comments
  • Rteuixl
    119 days
    # text 0.21 KB | 0 0
    1. Best t33n active cpx link daily updates!
    2.  
    3. Copy and paste the link in a new browser tab and then hit enter!
    4.  
    5. https://crazyporn.@xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400
    6.  
    7. Remove the @
  • Comment was deleted
Add Comment
Please, Sign In to add comment