example12_responsive.php HOME Examples overview Download Ask a question
example14.php

AJAX-ZOOM - load zoom viewer in an (responsive) iframe

There are several reasons why you would want to embed AJAX-ZOOM into an iframe. In fact this is the easiest way to embed AJAX-ZOOM as you do not need the jQuery core in the parent page and you do not need any other scripts too. One of the immanent reasons is that because of simple API usage and programming you can not have more than one instances of AJAX-ZOOM showing simultaneously at a time within one page. You can however switch between several instances like in example29.php.

If your iframe is responsive and AJAX-ZOOM is triggered fullscreen inside this iframe, then it will adjust instantly when iframe is resized. Additionally you can place more than one player into a page. Mouse wheel zoom on player is disabled in this examples when the player is not in fullscreen view but it can be enabled if needed. Please note that "cross-domain" usage is not supported by the regular license.

New: if you include "/axZm/axZm.iframe.js" into parent page (e.g. like this page with iframes) and pass iframe ID to the player over query string, then fullscreen will also work for mobile devices.

360° spin Local

Not triggered with browser API fullscreen and does work on mobile devices including IOS without opening new window or something like that.


<!--
* Copy only axZm.iframe.js once into head or body, 
* No other files from AJAX-ZOOM are needed on the page / server which includes iframe 
* jQuery is not needed
* PHP is not needed -> this page could be HTML

* axZm.iframe.js is only needed if you want AJAX-ZOOM player 
* to be able to open at fullscreen on mobile devices from within iframe 
* or full browser window on any device when AJAX-ZOOM option "fullScreenApi" is disabled
* allowfullscreen is not needed then
-->
<script type="text/javascript" src="../axZm/axZm.iframe.js"></script>

<!--
* The iframe element can be responsive
* It should have an (unique) ID!
* The value of its ID should be passed as "iframeID" parameter to AJAX-ZOOM

* example33_vario.php is just an example which is prepared to respond to several parameters
* You can create your own file or change the parameters, 
* retrieve data from DB within this file or whatever...

* PARAMETERS of example33_vario.php TO DEFINE WHICH DATA TO LOAD
* @ 3dDir - path to folder with 360 degree images, or
* @ zoomData - multiple 2D image paths devided by vertical dash |, or
* @ zoomDir - path to folder with several images for gallery

* SOME OPTIONAL PARAMETERS, AJAX-ZOOM HAS HUNDREDS OTHER
* @ spinReverse - reverse spin direction
* @ spinReverseZ - reverse spin direction for 3D on vertical axis
* @ spinBounce - should be enabled when it is e.g. about 180 degree spin and not full 360 rotation
* @ mouseScrollEnable - disable mouse wheel zoom for desktop devices when not in fullscreen
* @ spinNoInit - do not start spinning on load
* @ fullScreenApi - if 0 or false is passed, the player will not use fullscreen desktop browser API
* @ stepZoom - disable zoom transition when zooming with mouse wheel

* @ example - value of configuration - set defined in /axZm/zoomConfigCustom.inc.php
			  default "example" value in example33_vario.php is "spinIpad"
			  in /axZm/zoomConfigCustom.inc.php you can create your own sets
-->
<iframe 
	class="ajaxzoom_iframe" 
	width="100%" 
	frameborder="0" 
	id="ajaxzoom_frame_1" 
	src="example33_vario.php?3dDir=/pic/zoom3d/Uvex_Occhiali&spinReverse=0&mouseScrollEnable=1&spinNoInit=1&iframeID=ajaxzoom_frame_1" 
	scrolling="no" 
	allowfullscreen>
</iframe>

Replace some image (or any other html element) on click with AJAX-ZOOM 360 product spin, AJAX-ZOOM gallery or whatever else


		
<div class="ajaxzoom_image" 
	data-src="http://www.ajax-zoom.com/examples/example33_vario.php?3dDir=/pic/zoom3d/Canon_1100D&mouseScrollEnable=1&fullScreenApi=0">
	<img src="../axZm/icons/media-360-1200.png" style="max-width: 100%; max-height: 100%;" />
</div>

<script type="text/javascript">
jQuery("body").on("click", ".ajaxzoom_image", function() {
	if ($(this).attr("data-isrc")) {
		// generate a unique ID if not present
		// other than class the ID of an element should be unique anyway
		if (!$(this).attr("id")) {
			var min = 11111111111;
			var max = 99999999999;
			$(this).attr("id", "ajaxzoom_" + new Date().getTime() + Math.floor(Math.random() * (max - min + 1)) + min)
		}
		// create iframe and put as src the data-src of the div
		var iframe = $("<iframe />");
		iframe.attr({
			width: "100%",
			frameborder: "0",
			class: "ajaxzoom_iframe",
			scrolling: "no",
			id: $(this).attr("id"),
			allowfullscreen: true,
			src: $(this).attr("data-isrc") + "&iframeID=" + $(this).attr("id")
		});

		$(this).replaceWith(iframe);
	}
});
</script>
		
			

Some image (gallery) from http://www.ajax-zoom.com


<iframe 
	class="ajaxzoom_iframe" 
	width="100%" 
	frameborder="0" 
	id="ajaxzoom_frame_2" 
	src="http://www.ajax-zoom.com/examples/example33_vario.php?zoomDir=trasportation&zoomFile=transportation_007.jpg&mouseScrollEnable=1&iframeID=ajaxzoom_frame_2" 
	scrolling="no" 
	allowfullscreen>
</iframe>

360° spin from http://www.ajax-zoom.com


<iframe 
	class="ajaxzoom_iframe" 
	width="100%" 
	frameborder="0" 
	id="ajaxzoom_frame_3" 
	src="http://www.ajax-zoom.com/examples/example33_vario.php?3dDir=/pic/zoom3d/Ecco&spinReverse=1&mouseScrollEnable=1&spinNoInit=1&iframeID=ajaxzoom_frame_3" 
	scrolling="no" 
	allowfullscreen>
</iframe>

Local iframe


<iframe 
	class="ajaxzoom_iframe" 
	width="100%" 
	frameborder="0" 
	id="ajaxzoom_frame_5" 
	src="example33_vario.php?zoomData=/pic/zoom/furniture/furniture_006.jpg&mouseScrollEnable=1&iframeID=ajaxzoom_frame_5" 
	scrolling="no" 
	allowfullscreen>
</iframe>

Comments (0)

Leave a Comment

Name (required):
Email (required):
Website:
Your comment (no html):
Looking for a place to add a personal image? Visit www.gravatar.com to get Your own gravatar, a globally-recognized avatar. After you're all setup, Your personal image will be attached every time you comment.