Insert advertisement banner between pages
Hi all,
I want to add some image banners for advertising. Example:
- page 3
- banner ads
- page 4
How can I do that.
I have read the document but no idea to custom.
Regards
You could do this in the presentation layout by listening for pagefocus events and when you get to page 4, hide the document and show an ad until the user clicks "next" or something (then show the document and page 4).
For example:
var lastPage;
viewer.on('pagefocus', function (event) {
if (event.data.page === 4 && lastPage === 3) {
//hide viewer, show ad
}
lastPage = event.data.page;
});
There's not really a simple way to do this (yet) for scrollable layouts. You could write your own layout that does this, but it would not be trivial to implement. I have been toying around with some ideas on how to do page manipulation (adding/removing/reordering, etc) as a first-class API on the viewer, but haven't had a chance to implement anything like that yet.
Hi Lakenen, thank for your response, let me try that.
Regards,
how can i start to edit my own layout please ? it mean, what exactly file i have to edit ? thank you
There's not yet very good documentation on how each of the built-in modes works, but you can find some examples if you look at the other layout modes section. Otherwise, you might want to check out the built in layouts (src/js/components/layout*).
I found this : src/js/component/view-base.js
should i add a add ads function here link : function ads() { }