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 ng-app="sortableApp" ng-controller="sortableController" class="container">
  <h2>ui.sortable demo</h2>
  <div class="floatleft">
    <ul ui-sortable="sortableOptions" ng-model="list" class="list">
      <li ng-repeat="item in list" class="item">

  <div class="floatleft" style="margin-left: 20px;">
    <ul class="list logList">
      <li ng-repeat="entry in sortingLog track by $index" class="logItem">
  <div class="clear"></div>

  <button ng-click="addItem()">Add Item</button>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
  <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.4/angular.min.js"></script>
  <script src="https://rawgithub.com/angular-ui/ui-sortable/master/src/sortable.js"></script>

              .list {
	list-style: none outside none;
	margin: 10px 0 30px;

.item {
	width: 200px;
	padding: 5px 10px;
	margin: 5px 0;
	border: 2px solid #444;
	border-radius: 5px;
	background-color: #EA8A8A;

	font-size: 1.1em;
	font-weight: bold;
	text-align: center;
	cursor: pointer;

.ui-sortable-helper {
  cursor: move;

/***  Extra ***/

body {
	font-family: Verdana, 'Trebuchet ms', Tahoma;

.logList {
	margin-top: 20px;
	width: 250px;
	min-height: 200px;
	padding: 5px 15px;
	border: 5px solid #000;
	border-radius: 15px;

.logList:before {
	content: 'log';
	padding: 0 5px;
	position: relative;
	top: -1.1em;
	background-color: #FFF;

.container {
	width: 600px;
	margin: auto;

h2 {
	text-align: center;

.floatleft {
  float: left;

.clear {
  clear: both;
button {
  margin:0 auto;

              var myapp = angular.module('sortableApp', ['ui.sortable']);

myapp.controller('sortableController', function ($scope) {

  //sample data
  $scope.list = [
    {text: 'Item 1', value: 1},
    {text: 'Item 2', value: 2},
    {text: 'Item 3', value: 3},
    {text: 'Item 4', value: 4},
    {text: 'Item 5', value: 5}
  $scope.sortingLog = [];
  $scope.sortableOptions = {
    axis: 'y',
    update: function(e, ui) {
      var logEntry = $scope.list.map(function(i){
        return i.value;
      }).join(', ');
      $scope.sortingLog.push('Update: ' + logEntry);
    stop: function(e, ui) {
      // this callback has the changed model
      var logEntry = $scope.list.map(function(i){
        return i.value;
      }).join(', ');
      $scope.sortingLog.push('Stop: ' + logEntry);
  var counter;
  $scope.addItem = function() {    
    counter = $scope.list.length;
    $scope.list.push( { text:'Item ' + (counter+1), value: (counter+1) } );
Loading ..................