Skip to content

Commit

Permalink
Add popover detection script and no-popover html class
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelCDL committed Nov 21, 2024
1 parent ff50779 commit 131a003
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion elements/_template-default.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" class="no-popover">
<head>
<meta charset="utf-8">
<title>CDLIB UI</title>
Expand Down
2 changes: 1 addition & 1 deletion elements/_template-page.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" class="no-popover">
<head>
<meta charset="utf-8">
<title>CDLIB UI</title>
Expand Down
1 change: 1 addition & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import './anchor-positioning.js'
import './headernav.js'
import './mediaqueries.js'
import './newsreel.js'
import './popover-support.js'
import './sidebarposts.js'
import './slideshow.js'
import './toggles.js'
7 changes: 7 additions & 0 deletions js/popover-support.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// ***** Popover Support for CSS ***** //

// If the popover element is detected in the browser, remove the no-popover class from the html tag.

if (window.HTMLElement.prototype.hasOwnProperty('popover')) { // eslint-disable-line no-prototype-builtins
document.querySelector('html').classList.remove('no-popover')
}

0 comments on commit 131a003

Please sign in to comment.