簡體   English   中英

在Wordpress中使用滾動功能進行搜索?

[英]Search with scroll function in Wordpress?

我有一個wordpress網站,一頁上有300個PDF文件。 我需要與wordpress頁面內的瀏覽器中的CTRL-F函數完全一樣的東西。 有什么辦法可以做到嗎?

我嘗試了一切...一步步菜鳥很棒!

基於 很容易找到,下次再做更好的研究。

 const form = document.getElementById('form'); const input = document.getElementById('input'); form.addEventListener('submit', (e) => { e.preventDefault(); findString(input.value); }); function findString(str) { let strFound; strFound = self.find(str); if (!strFound) { strFound = self.find(str, 0, 1); while (self.find(str, 0, 1)) continue; } if (!strFound) alert("String '" + str + "' not found!") return; } 
 <form id="form"> <input id="input" type="text" placeholder="Insert text to search" /> <br /> <br /> What is Lorem Ipsum? Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. Why do we use it? It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). </form> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM