advice welcome on iframe + static image strategy in PressBooks

38 views
Skip to first unread message

jackdrty

unread,
Nov 11, 2014, 10:15:03 PM11/11/14
to press...@googlegroups.com

For a data visualization text that I’m writing in PressBooks, my goal is to insert code that will display:

1) an interactive map via an HTML iframe in the online edition, and

2) a static substitute image in the pdf/epub/mobi export editions, with a link that readers may follow to view an online version

I've sketched out my current method for doing this at http://epress.trincoll.edu/pressbooks/chapter/iframe/

It works for online, epub, and mobi editions -- but not the pdf export. 

Advice is welcome on this approach, or an entirely different strategy, if you have one.

-Jack

Hugh McGuire

unread,
Nov 12, 2014, 9:56:27 AM11/12/14
to jackdrty, press...@googlegroups.com
Jack did you check to see if that makes a valid EPUB/MOBI? I don't think iframes are legal -- but maybe they are getting stripped out or just ignored? 

one somewhat hacky way to do it would be: 

<div class="web-only">
[iframe code]
</div>

<div class="not-web">
[img code]
</div>

and then add the following CSS snippets:

PDF.css 
.web-only {
display: none;
}

EPUB.css 
.web-only {
display: none;
}

WEB.css 
.not-web {
display: none;
}

we have these CSS snippets built into pressbooks.com (as well as:
.pdf-only
.not-pdf
.epub-only
.not-epub)

 ... but I don't think they make it through to the open source version themes.

Hugh.


--
You received this message because you are subscribed to the Google Groups "PressBooks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pressbooks+...@googlegroups.com.
Visit this group at http://groups.google.com/group/pressbooks.



--
---------------------------------------------------------------
hughmcguire.net | twitter.com/hughmcguire 
skype. h.mcguire | tel. +1.514.464.2047
---------------------------------------------------------------

jackdrty

unread,
Nov 12, 2014, 10:38:51 PM11/12/14
to press...@googlegroups.com
Hugh - Thanks for this excellent solution, which works much better than my *very* hacky one. I'll make a pull request to Brad's PB Textbooks theme to see if he'll add the CSS snippets there, too.

Jack

jackdrty

unread,
Nov 13, 2014, 12:00:40 AM11/13/14
to press...@googlegroups.com
And here's a link to the improved tutorial
Reply all
Reply to author
Forward
0 new messages