简体   繁体   中英

Search with scroll function in Wordpress?

i have a wordpress site with 300 PDF Files on one page. I need something exactly like the CTRL-F function in the browser inside my wordpress page. Is there any way I can do this?

I tried everything... A noob step by step would be awesome!

Based on this . It was very easy to find, do a better research next time.

 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> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM