cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div id="main">
  <div>
    <div>
      <input id="reset" type="button" value="   RESET   " />
    </div>
    <div>
      <label>Continuosly Rotating the Image</label>
      <input id="rotate" type="range" min="-1080" max="1080" value="0" />
    </div>
    <div>
      <label>Rotate the Image</label>
      <input id="rotate2" type="range" min="-1080" max="1080" value="0" />
    </div>
    <div id="applied">
      <h3>Transformation Applied</h3>
    </div>
    <div id="event">
      <h3>Event</h3>
    </div>
  </div>
  <div>
    <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/e/e6/Home_Icon.svg/512px-Home_Icon.svg.png" />
  </div>

</div>
            
          
!
            
              * {
  box-sizing: border-box;
}

div#main {
  width: 100%;
  margin: 0px auto;
}

div#main > div {
 float:left;
}

div#main > div:nth-child(1) > div {
  margin: 2em;
}

div#main > div:nth-child(2) {
  text-align: center;
}

img {
  width: 50%;
}

h1,h3 {
  text-align: center;
}

            
          
!
            
              //Function executed when the HTML document is Ready (full loaded)
		$(function() {

			//Get the main image for future references
			var image = $("div > div:nth-child(2) img");
			var text = "<h3>Applied Transformation</h3>";
			var evento ="<h3>Occured Event</h3>";


			//Continuously Rotate Slider Handler
			$("#rotate").on("input",function(event) {

				//Get the value of the slider
				var value = $(this).val();

        //Rotate the oirginal image to the current value of the slider
				image.css("transform","rotate(" + value + "deg)");

				//Show the text of the transformation applied
				$("#applied").html(text+"<p>"+"transform:"+"rotate("+value+"deg)</p>");

				//Show the event that has ocurred
				$("#event").html(evento+"<p>"+event.type+"</p>");
			});

			//On Change Rotate Slider Handler
			$("#rotate2").on("change",function(event) {


				//Get the value of the slider
				var value = $(this).val();

        //Rotate the oirginal image to the current value of the slider
				image.css("transform","rotate(" + value + "deg)");

				//Show the text of the transformation applied
				$("#applied").html(text+"<p>"+"transform:"+"rotate("+value+"deg)</p>");

				//Show the event that has ocurred
				$("#event").html(evento+"<p>"+event.type+"</p>");

			});

			//Handlers only for showing the kind of events that have happened
			$("#rotate2,  #rotate").on("focus",function(event) {

				//Show the event that has ocurred
				$("#event").html(evento+"<p>"+event.type+"</p>");

			});

			$("#rotate2").on("input",function(event) {

				//Show the event that has ocurred
				$("#event").html(evento+"<p>"+event.type+"</p>");

			});

			$("#rotate").on("change",function(event) {

				//Show the event that has ocurred
				$("#event").html(evento+"<p>"+event.type+"</p>");

			});


//Reset everything to the original value
			$("#reset").click(function(event) {
				$("input[type='range']").val(0);
				$("img").css({ "transform": "rotate(0deg)"});
				$("#applied").html(text);
				$("#event").html(evento);
			});


});

            
          
!
999px
Loading ..................

Console