Ticket #29979: 29979.7.diff
File 29979.7.diff, 2.7 KB (added by , 11 years ago) |
---|
-
wp-content/themes/twentyfifteen/js/functions.js
6 6 */ 7 7 8 8 ( function( $ ) { 9 var $body, $window, sidebar, toolbarOffset; 10 9 11 $( 'html' ).removeClass( 'no-js' ); 10 12 11 13 // Add dropdown toggle that display child menu items. … … 47 49 $( this ).toggleClass( 'toggled-on' ); 48 50 } ); 49 51 } )(); 52 53 54 // Sidebar (un)fixing: fix when short, un-fix when scroll needed 55 $body = $( 'body' ); 56 $window = $( window ); 57 sidebar = $( '#sidebar' )[0]; 58 toolbarOffset = $body.is( '.admin-bar' ) ? $( '#wpadminbar' ).height() : 0; 59 60 function fixedOrScrolledSidebar() { 61 if ( $window.width() >= 955 ) { 62 if ( sidebar.scrollHeight < ( $window.height() - toolbarOffset ) ) { 63 $body.addClass( 'sidebar-fixed' ); 64 } else { 65 $body.removeClass( 'sidebar-fixed' ); 66 } 67 } else { 68 $body.removeClass( 'sidebar-fixed' ); 69 } 70 } 71 72 function debouncedFixedOrScrolledSidebar() { 73 var timeout; 74 return function() { 75 clearTimeout( timeout ); 76 timeout = setTimeout( function() { 77 timeout = null; 78 fixedOrScrolledSidebar(); 79 }, 150 ); 80 }; 81 } 82 83 $window.on( 'load.twentyfifteen', fixedOrScrolledSidebar ).on( 'resize.twentyfifteen', debouncedFixedOrScrolledSidebar() ); 84 50 85 } )( jQuery ); 86 No newline at end of file -
wp-content/themes/twentyfifteen/style.css
3799 3799 3800 3800 @media screen and (min-width: 59.6875em) { 3801 3801 body:before, 3802 .si te-header,3803 . main-navigation,3804 .s ocial-navigation,3805 . widget {3802 .sidebar-fixed .site-header, 3803 .sidebar-fixed .main-navigation, 3804 .sidebar-fixed .social-navigation, 3805 .sidebar-fixed .widget { 3806 3806 -webkit-transform: translateZ(0); /* Fixes flashing bug with scrolling on iOS Safari */ 3807 3807 } 3808 3808 3809 .sidebar-fixed .sidebar { 3810 position: fixed; 3811 } 3812 3809 3813 body:before { 3810 3814 background-color: #fff; 3811 3815 box-shadow: 0 0 1px rgba(0, 0, 0, 0.15); … … 3826 3830 3827 3831 .sidebar { 3828 3832 float: left; 3829 height: 100%;3830 3833 margin-right: -100%; 3831 3834 max-width: 413px; 3832 overflow-y: scroll; 3833 -webkit-overflow-scrolling: touch; /* Enable momentum scrolling on iOS Safari */ 3834 position: fixed; 3835 position: relative; 3835 3836 width: 29.4118%; 3836 3837 } 3837 3838 3838 .admin-bar .sidebar {3839 height: -webkit-calc(100% - 32px);3840 height: calc(100% - 32px);3841 }3842 3843 3839 .secondary { 3844 3840 background-color: transparent; 3845 3841 display: block;