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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <div class="ui-newsticker">
  <ul class="ui-newsticker-list">
    <li class="ui-newsticker-item">
      That open was light. After also shall first rule third every place spirit light. Beginning together their hath, winged firmament.
    <li class="ui-newsticker-item">
      That creature his bring waters female morning place Give bearing in isn't from. Without his fowl void bearing. Blessed give.
    <li class="ui-newsticker-item">
      And also. Firmament and Give. Sea replenish gathered give in for whose tree their a said multiply abundantly give years.


                body {
  padding: 15px;

@mixin ui-newsticker-mixin($namespace: ui) {
	$background-color: #bbb;
	$background-hover-color: #ddd;
	$radius: 5px;
	$font-color: #402726;
	$font-family: verdana;
	$font-size: 13px;
	$top: 8px;
	$height: 30px;
	$interval: 10px;

	.#{$namespace}-newsticker {
		@include rounded-box;
		background: $background-color;
		color: $font-color;
		cursor: default;
		font-family: $font-family;
		font-weight: bold;
		font-size: $font-size;
		line-height: $font-size*1.2;
		padding: 0 $interval 0 $interval;
		height: $height;
		position: relative;
		overflow: hidden;
			background: $background-hover-color;
		position: absolute;
		top: $top;
		height: $height;
		overflow: hidden;
	.#{$namespace}-newsticker-item {
		height: $height;
		overflow: hidden;
		white-space: nowrap;

@mixin rounded-box($radious: 10px){
	border-radius: $radious;
	-webkit-border-radius: $radious;
	-moz-border-radius: $radious;

@include ui-newsticker-mixin(ui);


                (function($) {
  $.fn.newsticker = function(opts) {
    var $newsticker = $(this),
      $frame = $newsticker.find('.ui-newsticker-list'),
      $item = $frame.find('.ui-newsticker-item'),
      $next = {},
      startPos = 0,
      stop = false,
      config = $.extend({}, {
        height: 30,
        speed: 800,
        interval: 3000,
        move: null
      }, opts);

    function Newsticker(config) {
      this.config = config;
      this.init($newsticker, config.height);

    Newsticker.prototype = {
      calStartPos: function(height, lineHeight) { //calculate start position
        return (height - lineHeight) / 2;
      setStartPos: function(frame, pos) { //set start position
        frame.css('top', pos);
      suspend: function() { //suspend newsticker
        $newsticker.on('mouseover mouseout', function(e) {
          stop = e.type === 'mouseover' ? true : false;
      move: function() { //activate newsticker
        if ($.isFunction(config.move)) {
        } else {
          setInterval(function() {
            if (!stop) {
              var $current = $frame.find('.current');

                top: '-=' + config.height + 'px'
              }, config.speed, function() {
                $next = $frame.find('.current').next().addClass('current');
                $frame.css('top', startPos + 'px');
          }, config.interval);
      init: function(ticker, height) { //init settings
        var $ticker = $(ticker),
          $frame = $ticker.find('.ui-newsticker-list'),
          $firstItem = $frame.find('.ui-newsticker-item').eq(0),
          lineHeight = parseInt($ticker.css('lineHeight').split('px')[0]) || 15;

        $ticker.css('height', height); //set customized height
        startPos = this.calStartPos(height, lineHeight);
        this.setStartPos($frame, startPos);
        $firstItem.addClass('current'); //set start item
        this.suspend(); //trigger mouse event for suspending newsticker
        this.move(); //activate newsticker

    return new Newsticker(config);

$(function() {