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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <h3>TSG Ticker Plugin</h3>
<div class="offers ticker">
		<ul>
				<li class="item active">10% off your first purchase when you <a href="#">sign up</a>!</li>
				<li class="item">Free Shipping on orders over $100!</li>
		</ul>
</div>

<h3>Bootstrap Carousel</h3>
<p>Using the Bootstrap Carousel with the TSG Ticker Plugin CSS to handle the transitions.</p>
<div class="offers carousel" data-ride="carousel" data-interval="5000">
		<ul>
				<li class="item active">10% off your first purchase when you <a href="#">sign up</a>!</li>
				<li class="item">Free Shipping on orders over $100!</li>
		</ul>
</div>
              
            
!

CSS

              
                .offers {
		position: relative;
		height: 18px;
}

.offers .item {
		position: absolute;
		top: 0;
		-webkit-transition: -webkit-transform .3s ease-in, opacity .3s linear;
		-moz-transition: -moz-transform .3s ease-in, opacity .3s linear;
		-ms-transition: -ms-transform .3s ease-in, opacity .3s linear;
		-o-transition: -o-transform .3s ease-in, opacity .3s linear;
		transition: transform .3s ease-in, opacity .3s linear;
}

.offers .item:not(.active) {
		-webkit-transform: translateY(-100%);
		-moz-transition: translateY(-100%);
		-ms-transition: translateY(-100%);
		-o-transition: translateY(-100%);
		transform: translateY(-100%);
		opacity: 0;
}
              
            
!

JS

              
                /*!
 * TSG Ticker Plugin v1.0.0
 * http://www.thatstevensguy.com/
 *
 * Released under the MIT license.
 * Copyright 2015, That Stevens Guy
 */

(function($) {

		$.fn.ticker = function(options) {

				var settings = $.extend({
						timeout: 5000,
						targetClass: '.item',
						activeClass: '.active'
				}, options);

				this.each(function() {

						var ticker = $(this);
						var interval;

						$(ticker).on('mouseover', function() {
								pause(ticker);
						});

						$(ticker).on('mouseout', function() {
								start(ticker);
						});

						function start() {
								interval = setInterval(next, settings.timeout);
						}

						function pause() {
								clearInterval(interval);
						}

						function next() {
								var target;
								target = $(ticker).find(settings.targetClass + settings.activeClass).next();
								target = target.length ? target : $(ticker).find(settings.targetClass).first();
								$(ticker).find(settings.targetClass + settings.activeClass).removeClass(settings.activeClass.replace('.', ''));
								$(target).addClass(settings.activeClass.replace('.', ''));
						}

						start(this);

				});

		};

}(jQuery));

jQuery(document).ready(function($) {
		$('.ticker').ticker();
});
              
            
!
999px

Console