readium / readium-js-viewer

👁 ReadiumJS viewer: default web app for Readium.js library
BSD 3-Clause "New" or "Revised" License
550 stars 186 forks source link

[QUESTION] Event after Content load in iframe #641

Closed deepeshuniyal closed 7 years ago

deepeshuniyal commented 7 years ago

This issue is a Question

I am working to readium-js-viewer, I need the event after the content load in the iframe so I can customise the data as per my requirement.

I have tried with readium.reader.on(ReadiumSDK.Events.CONTENT_DOCUMENT_LOADED, function ($iframe, spineItem) but it's calling before the content load.

So can please tell me how can I achieve this. Thanks.

danielweck commented 7 years ago

listen to the pagination event instead (I can't remember the exact name).

danielweck commented 7 years ago

PAGINATION_CHANGED

https://github.com/readium/readium-shared-js/blob/master/js/globals.js

deepeshuniyal commented 7 years ago

Hi @danielweck ,

This event is triggered before the content loaded, actually what I required is the event after all content loaded in iframe, so I can append one for

code inside the iframe.

danielweck commented 7 years ago

the behaviour you describe is abnormal. sounds like a bug! what browser?

deepeshuniyal commented 7 years ago

Hi @danielweck ,

I am using Google Chrome Version 59.0.3071.109 (Official Build) (64-bit).

My requirement is I have to open a custom menu when user select any text (inside iframe). Ex:- As user select any text then custom menu will open with option( copy, highlight) and then I just want to integrate with server side for that particular user, So next time when same user goes to that particular chapter the same text show as highlighted.

For doing this I need a event after the content loaded in iframe and then I can do formatting that text.

Hope you understand my requirement.

danielweck commented 7 years ago

There are other features in Readium that depend on the "loaded" events, and they just seem to work fine right now. In other words, I am not able to reproduce this bug. What EPUB are you testing with?

deepeshuniyal commented 7 years ago

I have achieved what was my requirement, thanks.