| 
			
			 | 
		#1 | 
| 
			
			
			
			 Fanatic 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 559 
				Karma: 400004 
				Join Date: Feb 2009 
				
				
				
				Device: ONYX M96 
				
				
				 | 
	
	
	
		
		
			
			 
				
				EPUB3: resize SVG in javascript
			 
			
			
			I'm working on a EPUB3 with a SVG inline image with animation and interactivity. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	I'd like to change the SVG size, according to pixel width and height of the ebook page, because ADE desktop often opens ebook in landscape mode instead portrait ad "cut" the SVG in half. I try window.innerWidth, window.innerHeight, it worked in iBooks, but I got wrong values in ADE. I try outerWidth / outerHeight, it worked in ADE, but I got wrong values in iBooks... Suggestion? Thank you Fabrizio  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#2 | 
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,763 
				Karma: 24088559 
				Join Date: Dec 2010 
				
				
				
				Device: Kindle PW2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Since you're working on epub3 books you could "cheat" and query the value of navigator.epubReadingSystem.name (RMSDK vs. ibooks) and use different calcualation methods for ADE and iBooks.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#3 | 
| 
			
			
			
			 Resident Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80,784 
				Karma: 150249619 
				Join Date: Nov 2006 
				Location: Roslindale, Massachusetts 
				
				
				Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Make two versions. One that works and one for iBooks.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		
 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#4 | 
| 
			
			
			
			 Fanatic 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 559 
				Karma: 400004 
				Join Date: Feb 2009 
				
				
				
				Device: ONYX M96 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Thank you for the answers. I find a way to have value from ADE and iBooks too... but I discover the values ADE gives to me are wrong with window.outerHeight too. Damn.
		 
		
	
		
		
		
		
		
		
		
		
		
		
		
			Last edited by fbrzvnrnd; 11-04-2016 at 08:45 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#5 | 
| 
			
			
			
			 Fanatic 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 559 
				Karma: 400004 
				Join Date: Feb 2009 
				
				
				
				Device: ONYX M96 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			UPDATE: outerWidth gives me dimension of ALL the ADE window, TOC space included. I hate Adobe.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#6 | 
| 
			
			
			
			 Fanatic 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 559 
				Karma: 400004 
				Join Date: Feb 2009 
				
				
				
				Device: ONYX M96 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			No, actually I can not find a way to know the size of a ebook page with Adobe.
		 
		
	
		
		
		
		
		
		
		
		
		
		
	
	 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#7 | |
| 
			
			
			
			 Grand Sorcerer 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,763 
				Karma: 24088559 
				Join Date: Dec 2010 
				
				
				
				Device: Kindle PW2 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 (I suck at JavaScript and CSS, but many MR users are much more knowledgeable than me and might have an idea how to solve this problem.)  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#8 | 
| 
			
			
			
			 Curmudgeon 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 629 
				Karma: 1623086 
				Join Date: Jan 2012 
				
				
				
				Device: iPad, iPhone, Nook Simple Touch 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#9 | 
| 
			
			
			
			 Bookmaker & Cat Slave 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503 
				Karma: 158448243 
				Join Date: Apr 2010 
				Location: Phoenix, AZ 
				
				
				Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#10 | 
| 
			
			
			
			 Fanatic 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 559 
				Karma: 400004 
				Join Date: Feb 2009 
				
				
				
				Device: ONYX M96 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I attach a simple EPUB3: when you open the page it looks for width and height and draw a svg with a border big as the page. It works in iBooks, it do not work in adobe that gives ever 300 width and 150 height (you can read 120 because I leave 30px in height for avoid overflow in iBooks). I do not find a way to have REAL values of page in ADE.
		 
		
	
		
		
			 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#11 | 
| 
			
			
			
			 Fanatic 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 559 
				Karma: 400004 
				Join Date: Feb 2009 
				
				
				
				Device: ONYX M96 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#12 | |
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,877 
				Karma: 8821117 
				Join Date: Mar 2013 
				Location: Rosario - Santa Fe - Argentina 
				
				
				Device: Kindle 4 NT 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Code: 
	<body style="margin:0; padding:0">
    <div style="text-align: center; padding: 0pt; margin: 0pt;">
         <svg xmlns="http://www.w3.org/2000/svg" height="95%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 600 900" width="100%" style="border: 10px solid black" xmlns:xlink="http://www.w3.org/1999/xlink">
         </svg>
    </div>
</body>
Rubén  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#13 | |
| 
			
			
			
			 Fanatic 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 559 
				Karma: 400004 
				Join Date: Feb 2009 
				
				
				
				Device: ONYX M96 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#14 | |
| 
			
			
			
			 Wizard 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,877 
				Karma: 8821117 
				Join Date: Mar 2013 
				Location: Rosario - Santa Fe - Argentina 
				
				
				Device: Kindle 4 NT 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Of course, that svg is empty but you can full it with whatever. Perhaps your troubles are due to the image you are using with the svg wrapper or the way that you are using to put stuff inside; what is the size of that image (in pixels)? And, what things do you want to put inside? Last edited by RbnJrg; 11-05-2016 at 08:33 PM.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#15 | |
| 
			
			
			
			 Fanatic 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 559 
				Karma: 400004 
				Join Date: Feb 2009 
				
				
				
				Device: ONYX M96 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
            
| Thread Tools | Search this Thread | 
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| EPUB3 and svg files | roger64 | ePub | 20 | 07-12-2022 02:19 PM | 
| ePub3: localStorage/JavaScript/RTL support | Doitsu | ePub | 7 | 06-02-2015 07:55 AM | 
| Is there any android epub reader supporting epub3 with audio/video/javascript? | happycoding | Android Developer's Corner | 10 | 07-29-2014 12:16 PM | 
| Create a javascript quizz for Epub3 in Sigil | BertrandThibaut | Sigil | 3 | 01-26-2014 10:04 AM | 
| JAVASCRIPT support in ePub2/ePub3 | Raja1205 | ePub | 7 | 09-03-2012 07:48 AM |