Fix twentyfifteen sidebar

Using theia-sticky-sidebar script instead of the original script.
This commit is contained in:
Dan 2025-03-17 07:22:42 +07:00
commit 6149e42f46
3 changed files with 5 additions and 59 deletions

View file

@ -76,61 +76,6 @@
} );
} )();
/**
* Add or remove ARIA attributes.
*
* Uses jQuery's width() function to determine the size of the window and add
* the default ARIA attributes for the menu toggle if it's visible.
*
* @since Twenty Fifteen 1.1
*/
function onResizeARIA() {
if ( 955 > $window.width() ) {
button.attr( 'aria-expanded', 'false' );
secondary.attr( 'aria-expanded', 'false' );
button.attr( 'aria-controls', 'secondary' );
} else {
button.removeAttr( 'aria-expanded' );
secondary.removeAttr( 'aria-expanded' );
button.removeAttr( 'aria-controls' );
}
}
// Sidebar scrolling.
function resizeAndScroll() {
var windowPos = $window.scrollTop(),
windowHeight = $window.height(),
sidebarHeight = $sidebar.height(),
pageHeight = $( '#page' ).height();
if ( 955 < $window.width() && pageHeight > sidebarHeight && ( windowPos + windowHeight ) >= sidebarHeight ) {
$sidebar.css({
position: 'fixed',
bottom: sidebarHeight > windowHeight ? 0 : 'auto'
});
} else {
$sidebar.css('position', 'relative');
}
}
$( function() {
$body = $( document.body );
$window = $( window );
$sidebar = $( '#sidebar' ).first();
$window
.on( 'scroll.twentyfifteen', resizeAndScroll )
.on( 'load.twentyfifteen', onResizeARIA )
.on( 'resize.twentyfifteen', function() {
clearTimeout( resizeTimer );
resizeTimer = setTimeout( resizeAndScroll, 500 );
onResizeARIA();
} );
$sidebar.on( 'click.twentyfifteen keydown.twentyfifteen', 'button', resizeAndScroll );
for ( var i = 0; i < 6; i++ ) {
setTimeout( resizeAndScroll, 100 * i );
}
} );
$('#sidebar, #content').theiaStickySidebar();
} )( jQuery );

File diff suppressed because one or more lines are too long

View file

@ -106,9 +106,9 @@
<!--[if lte IE 8]><script type='text/javascript' src='<?php echo theme_path();?>js/html5.js'></script><![endif]-->
<script type="text/javascript" src="<?php echo theme_path();?>js/jquery.js"></script>
<script type="text/javascript" src="<?php echo theme_path();?>js/jquery-migrate.js"></script>
<script type="text/javascript" src="<?php echo theme_path();?>js/functions.js?v=1"></script>
<script type="text/javascript" src="<?php echo theme_path();?>js/theia-sticky-sidebar.min.js"></script>
<script type="text/javascript" src="<?php echo theme_path();?>js/functions.js?v=2"></script>
<script type="text/javascript" src="<?php echo theme_path();?>js/skip-link-focus-fix.js"></script>
<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
</body>
</html>