Skip to content

Commit 7fb65ce

Browse files
committed
Remove scrollbar detection
1 parent 6049e8d commit 7fb65ce

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

themes/10up-block-theme/src/ThemeCore.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ public function setup() {
2626
add_action( 'after_setup_theme', [ $this, 'i18n' ] );
2727
add_action( 'after_setup_theme', [ $this, 'theme_setup' ] );
2828

29-
add_action( 'wp_head', [ $this, 'js_detection' ], 0 );
30-
add_action( 'wp_head', [ $this, 'scrollbar_detection' ], 0 );
31-
3229
do_action( 'tenup_block_theme_loaded' );
3330
}
3431

@@ -86,22 +83,6 @@ function () {
8683
do_action( 'tenup_block_theme_init' );
8784
}
8885

89-
90-
91-
/**
92-
* Handles scrollbar width detection.
93-
*
94-
* Adds a JavaScript event listener to the DOMContentLoaded event. When the DOM is fully loaded,
95-
* it calculates the width of the scrollbar and sets a CSS variable `--wp--custom--scrollbar-width` with the width.
96-
* It also adds an event listener to the window resize event to update the scrollbar width when the window is
97-
* resized.
98-
*
99-
* @return void
100-
*/
101-
public function scrollbar_detection() {
102-
echo '<script>window.addEventListener("DOMContentLoaded",()=>{const t=()=>window.innerWidth-document.body.clientWidth;const e=()=>{document.documentElement.style.setProperty("--wp--custom--scrollbar-width",`${t()}px`)};e();});</script>' . "\n";
103-
}
104-
10586
/**
10687
* Get an initialized class by its full class name, including namespace.
10788
*

0 commit comments

Comments
 (0)