We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The text was updated successfully, but these errors were encountered:
おそらく、
--- title: "全てのカテゴリから検索" draft: false --- <input id = "query" onkeyup="search(this.value)" style="width: 90%;" autocomplete="off" autofocus placeholder="検索キーワードを入れてください" /> <script> // 検索 function search(query) { $(".card").each(function(i, elem) { var question = $(elem).find("span").text().toLowerCase(); var answer = $(elem).find(".card-body").text().toLowerCase(); if (query == "" || (question.indexOf(query) == -1 && answer.indexOf(query) == -1)) { $(elem).css("display", "none"); } else { $(elem).css("display", "block"); } }) } // ハッシュフラグメントの値で検索を実行 function searchWithHash() { const hash = decodeURI(location.hash.substring(1)); search(hash); // 必要があれば input 要素の値を更新 const queryElem = document.getElementById('query'); if (queryElem.value !== hash) { queryElem.value = hash; } } // ハッシュフラグメント付きの URL でページを開いたときに検索 window.addEventListener('DOMContentLoaded', searchWithHash); // ページ表示後にハッシュフラグメントが変化したら検索 // window.addEventListener('hashchange', searchWithHash); </script> {{< result >}}
みたいに変えれば URL が動的に変わらないので検索できるようになりそうですが、その一方で検索語句(ハッシュフラグメント)付き URL の共有ができなくなるのが難点です。
Sorry, something went wrong.
No branches or pull requests
起こっている問題 / The Problem
スクリーンショット / Screenshot
期待する見せ方・挙動 / Expected Behavior
起こっている問題の再現手段 / Steps to Reproduce
動作環境・ブラウザ / Environment
The text was updated successfully, but these errors were encountered: