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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console