Changeset 30025
- Timestamp:
- 10/26/2014 03:03:45 PM (10 years ago)
- Location:
- trunk/src/wp-content/themes/twentyfifteen
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfifteen/js/functions.js
r30013 r30025 7 7 8 8 ( function( $ ) { 9 var $body, $window, sidebar, toolbarOffset; 10 9 11 $( 'html' ).removeClass( 'no-js' ); 10 12 … … 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 ); -
trunk/src/wp-content/themes/twentyfifteen/style.css
r30023 r30025 3804 3804 @media screen and (min-width: 59.6875em) { 3805 3805 body:before, 3806 .si te-header,3807 . main-navigation,3808 .s ocial-navigation,3809 . widget {3806 .sidebar-fixed .site-header, 3807 .sidebar-fixed .main-navigation, 3808 .sidebar-fixed .social-navigation, 3809 .sidebar-fixed .widget { 3810 3810 -webkit-transform: translateZ(0); /* Fixes flashing bug with scrolling on iOS Safari */ 3811 } 3812 3813 .sidebar-fixed .sidebar { 3814 position: fixed; 3811 3815 } 3812 3816 … … 3831 3835 .sidebar { 3832 3836 float: left; 3833 height: 100%;3834 3837 margin-right: -100%; 3835 3838 max-width: 413px; 3836 overflow-y: scroll; 3837 -webkit-overflow-scrolling: touch; /* Enable momentum scrolling on iOS Safari */ 3838 position: fixed; 3839 position: relative; 3839 3840 width: 29.4118%; 3840 }3841 3842 .admin-bar .sidebar {3843 height: -webkit-calc(100% - 32px);3844 height: calc(100% - 32px);3845 3841 } 3846 3842
Note: See TracChangeset
for help on using the changeset viewer.