HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
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.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div style="margin: auto; text-align: center">
<h1>Pure JavaScript Library for Image Rotating</h1>
<h6>Powered by MJZSoft</h6>
</div>
<div id="Ellipse">
<img class="RotatingIcon" src="https://raw.githubusercontent.com/mjza/ImageRotatorJS/master/img/img2.png">
<img class="RotatingIcon" src="https://raw.githubusercontent.com/mjza/ImageRotatorJS/master/img/img3.jpg">
<img class="RotatingIcon" src="https://raw.githubusercontent.com/mjza/ImageRotatorJS/master/img/img4.jpg">
<img class="RotatingIcon" src="https://raw.githubusercontent.com/mjza/ImageRotatorJS/master/img/img7.png">
<img class="RotatingIcon" src="https://raw.githubusercontent.com/mjza/ImageRotatorJS/master/img/img5.jpg">
<img class="RotatingIcon" src="https://raw.githubusercontent.com/mjza/ImageRotatorJS/master/img/img6.jpg">
<img class="RotatingIcon" src="https://raw.githubusercontent.com/mjza/ImageRotatorJS/master/img/img1.jpg">
</div>
<h3>The HTML Code</h3>
<p>
The elements to be displayed in an ellipse are defined in the HTML code
and must be assigned a class name which includes a unique string of characters.<br>
These elements must be nested in a parent DIV.
This parent DIV must be assigned a unique ID name and
the width and height will determine the horizontal and vertical dimensions of the ellipse. For example:<br>
<h4><div id="Ellipse" style="..."><br>
<img class="RotaitingIcon" src="img/One.gif" width="50" height="50" style="border:solid black 1px;"><br>
<div></h4>
</p>
<h3>Zoom</h3>
<p>
Each element may be 'Zoomed'
as it approaches the center bottom of the ellipse to give a 3D effect.
The 'Zoom' is specified in the initialization call
and is applied to the width, height and font size of the element.
</p>
<h3>Initialising the Ellipse</h3>
<p>
Each application would normally be initialised from a <BODY> or window onload event call
to function 'ImageRotatorJS'. For example:<br>
<h4><body onload="ImageRotatorJS('Ellipse','RotatingIcon',5,110,3000, 0, 90, 40, 'white');"></h4>
where:
<br>
<br>parameter 0 =(string) {containerId}: the unique ID name of the parent DIV.
<br>parameter 1 =(string) {elementsClass}: the unique string of element's class name to signify inclusion.
<br>parameter 2 =(digits) {rotationSpeed}: the rotation speed, 10 = fast, 500 = slow. 10 = 0.01 second
<br>parameter 3 =(digits) {zoomPercentage}: the element 'Zoom', 0 = no Zoom, 100 = 100% Zoom.
<br>parameter 4 =(digits) {holdDelay}: the initial 'Hold' delay. A number in milliseconds that tells how much it has to wait between rotations.
<br>parameter 5 =(digits) {rotationAngle}: +/- 0~360 degree. If we assume a Z axis orthogonal to the screen, then 45 degrees cause to sloop images to the screen
<br>parameter 6 =(digits) {startAngle}: +/- 0-360 degree. The initial position of the first image.
<br>parameter 7 =(digits) {reflectionPercentage}: 0~100. The amount of reflection of images
<br>parameter 8 =(string) {circumferenceDotsColor}: (optional) the color of the circumference (dotted), more uses for development purposes.
</p>
<h3>Controlling the Rotation</h3>
<p>
There are two functions to control the rotation, 'IRJS_StartRotation' and 'IRJS_StopRotation'
<h3>function 'IRJS_StopRotation'</h3>
Calling this function will stop the ellipse rotation. e.g:<br>
<h4><input type="button" name="" value="Stop" onmouseover="IRJS_StopRotation('Ellipse1');"></h4>
where:
<br>
<br>parameter 0 =(string) the unique ID name of the parent DIV.
<h3>function 'IRJS_StartRotation'</h3>
Calling this function will rotate the ellipse to an incremental point. e.g :<br>
<h4><input type="button" name="" value="Next" onclick="IRJS_StartRotation('Ellipse1',1);"><br>
<input type="button" name="" value="Back" onclick="IRJS_StartRotation('Ellipse1',-1);"></h4>
where:
<br>
<br>parameter 0 =(string) the unique ID name of the parent DIV.
<br>parameter 1 =(1 | -1) the direction of rotation, 1 = clockwise, -1 = anti clockwise.
<br>parameter 2 =(digits) (optional) to change the 'Hold' delay.
<br>
<br>
There are two similar functions with names 'startRotation' and 'stopRotation' that you can call on ImageRotatorJS object to start or stop the
rotation. Just you don't need to pass the id of the element but the rest arguments are needed.
</p>
body{
font-family:Tahoma, Geneva, sans-serif;
font-size:1em;
color:#FFFFFF;
background-color:#000000;
}
h3{
color:#00FF00;
}
h4{
font-family:"Courier New", Courier, monospace;
color:#33CCFF;
}
#Ellipse{
position:relative;
visibility:visible;
z-index:1;
width:700px;
height:80px;
border:none;
margin-top: 250px;
margin-bottom: 100px;
}
.RotatingIcon{
border:none;
width:80px;
}
var imageRotater = null;
function InitScripts(){
imageRotater = ImageRotatorJS('Ellipse','RotatingIcon',5,110,3000, 0, 90, 40, null);
};
InitScripts();
Also see: Tab Triggers