N
N
nastya_zholudeva2018-03-28 17:06:43
JavaScript
nastya_zholudeva, 2018-03-28 17:06:43

Clicking on an area in an iframe that is dynamically loaded?

There <div ref="viewer" id="area"></div>is an iframe in which the epub book is dynamically loaded (I use the epub.js library for these people). When searching for a book, we get a list of matches. When clicking on an element from the list, we go to the page and select the word we are looking for using the library method

this.rendition.annotations.highlight('epubcfi(' + cfi + ')')
. Removing a selection is implemented using
this.rendition.annotations.remove('epubcfi(' + this.cfi + ')')
.
Question: how can I make it so that by clicking on any place in the reader, the selection is removed? I tried to call document.onclick on the mounted event, but it didn’t work, because it works immediately and the user does not see the selection

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question