Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                	<article id="group" onMouseMove="group();">
		<section id="iris3d">
		<figure id="ground0"><img src="https://jb-martinez.net/content/html/img/iris3s/champ0.png"/></figure>
		<figure id="ground1"><img src="https://jb-martinez.net/content/html/img/iris3s/champ1.png"/></figure>
		<figure id="ground2"><img src="https://jb-martinez.net/content/html/img/iris3s/herbes.png"/></figure>
		<figure><img id="iris" onMouseMove="iris3d('open');" onMouseOut="iris3d('close');" src="https://jb-martinez.net/content/html/img/iris3s/photo4.png"/></figure>
		</section>
	</article>
              
            
!

CSS

              
                @charset "utf-8";
/* CSS Document */

#group {
	position: fixed;
	width: 100%;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
}

#iris3d {
	position: relative;
	display: block;
	width: 500px;
	height: 500px;
	perspective: 4000px;
	transform-style: preserve-3d;
	background-color: #fff;
	border: none!important;
	border: none!important;
}

#iris3d figure {
	position: absolute;
	display: block;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	margin: 0!important;
	padding: 0!important;
	border: none!important;
}

#iris3d img {
	width: 100%;
	height: auto;
	border: none!important;
}

#ground0 {
	z-index: -3;
    -webkit-transform: translateZ(0px) scale(0.94);
    transform: translateZ(0px) scale(0.94);		
}

#ground1 {
	z-index: -2;
    -webkit-transform: translateZ(120px) scale(0.94);
    transform: translateZ(120px) scale(0.94);	
}

#ground2 {
	z-index: -1;
    -webkit-transform: translateZ(240px) scale(0.94);
    transform: translateZ(240px) scale(0.94);		
}

#iris {
	z-index: 5;
    -webkit-transform: translateZ(360px) scale(0.94);
    transform: translateZ(360px) scale(0.94);		
}


              
            
!

JS

              
                // JavaScript Document

function findPos(el) {
	var x = y = w = h = 0;
	if(el.offsetParent) {
		x = el.offsetLeft;
		y = el.offsetTop;
		w = el.offsetWidth;
		h = el.offsetHeight;
	}
	return {'x':x, 'y':y, 'w':w, 'h':h};
}


function iris3d(act) {
	var parent = document.getElementById("iris3d");
	var fiche = document.getElementById("iris");
	var posParent = findPos(parent);
	var pos = findPos(fiche);
	var x = pos.x; var y = pos.y; var w = pos.w; var h = pos.h; /*-- position et taille de lélément div --*/
	
	var e = event;
	var mx = e.clientX - posParent.x; var my = e.clientY - posParent.y; /*-- position de la sourie : attention elever la marge ici 20 % de figure --*/
	
	var g = w / 4; /*-- proportion de changement de la photo : Divition de la largeur par le nombre de photos --*/
	

	if (act == 'open') {
		
	if (mx > x && mx < x + (g * 1)) {
		fiche.setAttribute("src", "https://jb-martinez.net/content/html/img/iris3s/photo" + 4 + ".png");
		parent.style = "transform: rotateY(0deg) rotateX(0deg);";
	}
	if (mx > x + (g * 1) && mx < x + (g * 2)) {
		fiche.setAttribute("src", "https://jb-martinez.net/content/html/img/iris3s/photo" + 3 + ".png");
		parent.style = "transform: rotateY(-20deg)";
	}
	if (mx > x + (g * 2) && mx < x + (g * 3)) {
		fiche.setAttribute("src", "https://jb-martinez.net/content/html/img/iris3s/photo" + 2 + ".png");
		parent.style = "transform: rotateY(-30deg)";
	}
	if (mx > x + (g * 3)) {
		parent.style = "transform: rotateY(-40deg)";
		fiche.setAttribute("src", "https://jb-martinez.net/content/html/img/iris3s/photo" + 1 + ".png");
	}
	
	}
	
	if (act == 'close') {
		
	fiche.setAttribute("src", "https://jb-martinez.net/content/html/img/iris3s/photo" + 4 + ".png");
		
	}

}

function group() {
	var parent = document.getElementById("iris3d");
	var fiche = document.getElementById("iris");

	
	var posParent = findPos(parent);
	var pos = findPos(fiche);
	
	var e = event;

	if (e.clientX > 1000) {
		parent.style = "transform: rotateY(-40deg)";
		fiche.setAttribute("src", "https://jb-martinez.net/content/html/img/iris3s/photo" + 1 + ".png");
	}
  
	if (e.clientX < posParent.x) {
		parent.style = "transform: rotateY(0deg)";
		fiche.setAttribute("src", "https://jb-martinez.net/content/html/img/iris3s/photo" + 4 + ".png");
	}	  
}
              
            
!
999px

Console