-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: closes search when focusout
- Loading branch information
Showing
6 changed files
with
81 additions
and
62 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function searchBlur() { | ||
const searchContainer = document.querySelector('.pagefind-ui__form'); | ||
|
||
searchContainer.addEventListener('focusout', function(event) { | ||
if (searchContainer.contains(event.relatedTarget)) { | ||
// Der Fokus ist innerhalb des Formulars auf ein anderes Element gesprungen | ||
return; | ||
} | ||
|
||
// Der Fokus ist außerhalb des Formulars gesprungen | ||
const drawer = document.querySelector('.pagefind-ui__drawer'); | ||
drawer.classList.add('pagefind-ui__hidden'); | ||
console.log('Das Formular oder ein Element darin hat den Fokus verloren'); | ||
}); | ||
} | ||
|
||
window.onload = function() { | ||
searchBlur(); | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,34 @@ | ||
{{ $myTitle := "" }} | ||
<p class="md-image"> | ||
<picture> | ||
{{ $width := .Width }} | ||
<picture> | ||
{{ $width := .Width }} | ||
|
||
{{ if gt $width 2200 }} | ||
{{ with .Resize "2200x" }} | ||
<source media="(min-width:2200px)" srcset="{{ .RelPermalink | safeURL }}" title="{{ $myTitle }}" loading="lazy"/> | ||
{{ end }} | ||
{{ end }} | ||
{{ if gt $width 2200 }} | ||
{{ with .Resize "2200x" }} | ||
<source media="(min-width:2200px)" srcset="{{ .RelPermalink | safeURL }}" title="{{ $myTitle }}" loading="lazy"/> | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ if gt $width 1500 }} | ||
{{ with .Resize "1500x" }} | ||
<source media="(min-width:1500px)" srcset="{{ .RelPermalink | safeURL }}" title="{{ $myTitle }}" loading="lazy"/> | ||
{{ end }} | ||
{{ end }} | ||
{{ if gt $width 1500 }} | ||
{{ with .Resize "1500x" }} | ||
<source media="(min-width:1500px)" srcset="{{ .RelPermalink | safeURL }}" title="{{ $myTitle }}" loading="lazy"/> | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ if gt $width 1200 }} | ||
{{ with .Resize "1200x" }} | ||
<source media="(min-width:1200px)" srcset="{{ .RelPermalink | safeURL }}" title="{{ $myTitle }}" loading="lazy"/> | ||
{{ end }} | ||
{{ end }} | ||
{{ if gt $width 1200 }} | ||
{{ with .Resize "1200x" }} | ||
<source media="(min-width:1200px)" srcset="{{ .RelPermalink | safeURL }}" title="{{ $myTitle }}" loading="lazy"/> | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ if gt $width 800 }} | ||
{{ with .Resize "800x" }} | ||
<source media="(min-width:800px)" srcset="{{ .RelPermalink | safeURL }}" title="{{ $myTitle }}" loading="lazy"/> | ||
{{ end }} | ||
{{ end }} | ||
{{ if gt $width 800 }} | ||
{{ with .Resize "800x" }} | ||
<source media="(min-width:800px)" srcset="{{ .RelPermalink | safeURL }}" title="{{ $myTitle }}" loading="lazy"/> | ||
{{ end }} | ||
{{ end }} | ||
|
||
{{ $tinyImage := . }} | ||
{{ if gt $width 500 }} | ||
{{ $tinyImage = .Resize "500x" }} | ||
{{ end }} | ||
<img src="{{ $tinyImage.RelPermalink | safeURL }}" alt="{{ $myTitle }}" title="{{ $myTitle }}" loading="lazy"/> | ||
</picture> | ||
</p> | ||
{{ $tinyImage := . }} | ||
{{ if gt $width 500 }} | ||
{{ $tinyImage = .Resize "500x" }} | ||
{{ end }} | ||
<img src="{{ $tinyImage.RelPermalink | safeURL }}" alt="{{ $myTitle }}" title="{{ $myTitle }}" loading="lazy"/> | ||
</picture> |