0

I want to post an old book on my wordpress website but since the book is so old there are a lot of words that readers may find unfamiliar. So I was thinking of adding a mouseover with the definition when they hover over a certain unfamiliar word. The problem is that the text is huge and a certain word "x" appears many times in different places in the text. Is is possible to somehow write a single program which creates a mouseover to every single "x" in the text? Or do I need to do each of them separately?

Artus
  • 165
  • 1
  • 2
  • 7

1 Answers1

1

You could write some JavaScript that evaluates the text on pageload and wraps each desired word with a specific CSS class. On this CSS class you could define your mouse hover and the function to be executed.

conste
  • 390
  • 1
  • 4
  • 16
  • I don't really know any of that. Also, wordpress only has html. – Artus Feb 15 '18 at 09:56
  • This is not true. There are different ways to include JavaScript in wordpress. If you don't want to write any code at all you have to rely on the existing wordpress plugins. But then please change your initial question in which you are asking how to write a "single program". – conste Feb 15 '18 at 10:05
  • I didn't know that. It's not that I don't want to write any code, I have searched how to do a mouseover in html and the code seems simple. You don't need to know html in order to do it, so I was hoping that there was a similar (straightforward) code for creating multiple mouseovers instead of just one. From you answer, it seems that there isn't such a straightforward code. Is that correct? – Artus Feb 15 '18 at 10:27
  • Not that I am aware of. – conste Feb 15 '18 at 10:52