123

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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div data-provide="calendar"></div>
            
          
!
            
              body
{
  margin:0;
}

#banner
{
  font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif;
  background-color:#207BBC;
  line-height:60px;
  overflow:auto;
}

#banner,
#banner a,
#banner a:hover,
#banner a:active 
{
  color:white;
  text-decoration:none;
}

#banner .logo
{
  font-size:18px;
  float:left;
  font-weight:100;
}

#banner .logo span.fa
{
  font-size:26px;
  margin-right:10px;
  vertical-align: text-bottom;
}

#banner .menu
{
  float:right;
}

#banner .menu-button
{
  display:none;
  float:right;
}

#banner ul.menu {
  padding:0;
  margin:0;
}

#banner ul.menu  li
{
  display:inline-block;
  list-style:none;
  padding:0 15px;
  cursor:pointer;
  font-size:14px;
  position:relative;
}

#banner ul.menu  li:hover
{
  background-color:#2180C4;
}

#banner ul.menu  li.selected {
  box-shadow: inset 0 -3px 0 white;
}

#banner ul.menu  li span {
  margin-top: 21px;
  margin-bottom: 21px;
  font-size: 17px;
}

#title
{
  background-color:#303030;
  height:200px;
  color:#ccc;
  text-align:center;
}

#main > .site-content > span.fa-spinner
{
  font-size:60px;
  margin: 40px auto;
  display:block;
  width: 60px;
  height: 60px;
}

#main .site-content img {
  width:100%;
}

#footer
{
  background-color:#E5E5E5;
  clear:both;
}

.site-content
{
  width:800px;
  margin:auto;
}

#main > .site-content.full
{
  padding-top:0;
  width:100%;
  display:table-row;
}

.left-menu {
  display:table-cell;
  background-color: #eee;
  border-left: 1px solid #ccc;
  border-right: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  box-shadow: 0px 0px 5px rgba(0, 0, 0, .2);
  min-height:400px;
}

.site-content.full > .left-menu {
  border-left:0;
}

.left-menu ul {
  margin:0;
  padding:0;
  min-height: 200px;
}

.left-menu ul li {
  list-style: none;
  padding: 6px 25px 6px 15px;
  cursor: pointer;
  white-space:nowrap;
}

.left-menu ul li:hover {
  background-color:#ddd;
}

.left-menu ul li.selected {
  border-right:3px solid #aaa;
}

.sub-content-container 
{
  display:table-cell;
  padding-left:20px;
  width:100%;
}

.sub-content  > span.fa-spinner
{
  font-size:40px;
  margin: 40px auto;
  display:block;
  width: 40px;
  height: 40px;
}

.center {
  text-align:center;
}

.underline-title {
  border-bottom:1px solid #ccc;
}

.new-version {
  display:inline-block;
  position: absolute;
  font-size: 12px;
  padding: 5px;
  background-color: green;
  color: white;
  border-radius: 4px;
  box-shadow: #222 0 0 10px;
  margin-top:20px;
  margin-left:5px;
}

.parameter,
.default-value,
.returns,
.related-methods {
  font-size: 15px;
  font-family: consolas;
}

.parameter {
  color: #006696;
}

.default-value,
.returns {
  color: #3C7202;
}

.related-methods {
  color:#7C0000;
}

span.link {
  font-family: consolas;
  font-size:13px;
  color: blue;
}

.parameter > ul > li{
  font-size: 12px;
}

code {
  display:block;
  margin:5px 0;
  padding: 12px;
}

code.inline {
  display:inline;
  padding: 0;
  background-color: none;
}

h1,
h2,
h3,
h4,
h5
{
  font-family:'Segoe UI','Helvetica Neue',Helvetica,Arial,sans-serif;

}

h1,
h2
{
  font-weight:100;
}

h1
{
  padding: 30px 0 15px 0;
  margin: 0;
  font-size:60px;
  display:inline-block;
}

h4 {
  font-size:16px;
  font-weight:bold;
}

p {
  margin: 15px 0;
}

li {
  list-style-type:square;
}

hr {
  margin:20px 80px;
}

@media (min-width: 1024px) {
  .site-content
  {
    width:800px;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .site-content
  {
    width:650px;
  }

  #banner ul.menu  li
  {
    padding:0 7px;
  }

  #title {
    height:160px;
  }

  h1 {
    padding: 20px 0 10px 0;
    font-size:50px;
  }

  h2 {
    font-size:25px;
  }
}


@media (max-width: 768px) {
  .site-content
  {
    width:100%;
    min-width:200px;
    padding:0 5px;
  }

  #banner .menu-button
  {
    display:inline-block;
    cursor:pointer;
    font-size:21px;
    padding:18px;
  }

  #banner ul.menu  {
    display:none;
    float:none;
    clear:both;
    left:0;
  }

  #banner ul.menu  li {
    display:block;
    width:100%;
  }

  #banner ul.menu  li.selected {
    box-shadow: inset 3px 0 0 white;
  }

  #title {
    height:120px;
  }

  h1 {
    padding: 15px 0 0 0;
    font-size:30px;
  }

  h2 {
    font-size:17px;
  }

  .new-version {
    right:5px;
    margin-top: -10px;
  }
}
            
          
!
            
              function editEvent(event) {
    $('#event-modal input[name="event-index"]').val(event ? event.id : '');
    $('#event-modal input[name="event-name"]').val(event ? event.name : '');
    $('#event-modal input[name="event-location"]').val(event ? event.location : '');
    $('#event-modal input[name="event-start-date"]').datepicker('update', event ? event.startDate : '');
    $('#event-modal input[name="event-end-date"]').datepicker('update', event ? event.endDate : '');
    $('#event-modal').modal();
}

function deleteEvent(event) {
    var dataSource = $('#calendar').data('calendar').getDataSource();

    for(var i in dataSource) {
        if(dataSource[i].id == event.id) {
            dataSource.splice(i, 1);
            break;
        }
    }
    
    $('#calendar').data('calendar').setDataSource(dataSource);
}

function saveEvent() {
    var event = {
        id: $('#event-modal input[name="event-index"]').val(),
        name: $('#event-modal input[name="event-name"]').val(),
        location: $('#event-modal input[name="event-location"]').val(),
        startDate: $('#event-modal input[name="event-start-date"]').datepicker('getDate'),
        endDate: $('#event-modal input[name="event-end-date"]').datepicker('getDate')
    }
    
    var dataSource = $('#calendar').data('calendar').getDataSource();

    if(event.id) {
        for(var i in dataSource) {
            if(dataSource[i].id == event.id) {
                dataSource[i].name = event.name;
                dataSource[i].location = event.location;
                dataSource[i].startDate = event.startDate;
                dataSource[i].endDate = event.endDate;
            }
        }
    }
    else
    {
        var newId = 0;
        for(var i in dataSource) {
            if(dataSource[i].id > newId) {
                newId = dataSource[i].id;
            }
        }
        
        newId++;
        event.id = newId;
    
        dataSource.push(event);
    }
    
    $('#calendar').data('calendar').setDataSource(dataSource);
    $('#event-modal').modal('hide');
}

$(function() {
    var currentYear = new Date().getFullYear();

    $('#calendar').calendar({ 
        enableContextMenu: true,
        enableRangeSelection: true,
        contextMenuItems:[
            {
                text: 'Update',
                click: editEvent
            },
            {
                text: 'Delete',
                click: deleteEvent
            }
        ],
        selectRange: function(e) {
            editEvent({ startDate: e.startDate, endDate: e.endDate });
        },
        mouseOnDay: function(e) {
            if(e.events.length > 0) {
                var content = '';
                
                for(var i in e.events) {
                    content += '<div class="event-tooltip-content">'
                                    + '<div class="event-name" style="color:' + e.events[i].color + '">' + e.events[i].name + '</div>'
                                    + '<div class="event-location">' + e.events[i].location + '</div>'
                                + '</div>';
                }
            
                $(e.element).popover({ 
                    trigger: 'manual',
                    container: 'body',
                    html:true,
                    content: content
                });
                
                $(e.element).popover('show');
            }
        },
        mouseOutDay: function(e) {
            if(e.events.length > 0) {
                $(e.element).popover('hide');
            }
        },
        dayContextMenu: function(e) {
            $(e.element).popover('hide');
        },
        dataSource: [
            {
                id: 0,
                name: 'Google I/O',
                location: 'San Francisco, CA',
                startDate: new Date(currentYear, 4, 28),
                endDate: new Date(currentYear, 4, 29)
            },
            {
                id: 1,
                name: 'Microsoft Convergence',
                location: 'New Orleans, LA',
                startDate: new Date(currentYear, 2, 16),
                endDate: new Date(currentYear, 2, 19)
            },
            {
                id: 2,
                name: 'Microsoft Build Developer Conference',
                location: 'San Francisco, CA',
                startDate: new Date(currentYear, 3, 29),
                endDate: new Date(currentYear, 4, 1)
            },
            {
                id: 3,
                name: 'Apple Special Event',
                location: 'San Francisco, CA',
                startDate: new Date(currentYear, 8, 1),
                endDate: new Date(currentYear, 8, 1)
            },
            {
                id: 4,
                name: 'Apple Keynote',
                location: 'San Francisco, CA',
                startDate: new Date(currentYear, 8, 9),
                endDate: new Date(currentYear, 8, 9)
            },
            {
                id: 5,
                name: 'Chrome Developer Summit',
                location: 'Mountain View, CA',
                startDate: new Date(currentYear, 10, 17),
                endDate: new Date(currentYear, 10, 18)
            },
            {
                id: 6,
                name: 'F8 2015',
                location: 'San Francisco, CA',
                startDate: new Date(currentYear, 2, 25),
                endDate: new Date(currentYear, 2, 26)
            },
            {
                id: 7,
                name: 'Yahoo Mobile Developer Conference',
                location: 'New York',
                startDate: new Date(currentYear, 7, 25),
                endDate: new Date(currentYear, 7, 26)
            },
            {
                id: 8,
                name: 'Android Developer Conference',
                location: 'Santa Clara, CA',
                startDate: new Date(currentYear, 11, 1),
                endDate: new Date(currentYear, 11, 4)
            },
            {
                id: 9,
                name: 'LA Tech Summit',
                location: 'Los Angeles, CA',
                startDate: new Date(currentYear, 10, 17),
                endDate: new Date(currentYear, 10, 17)
            }
        ]
    });
    
    $('#save-event').click(function() {
        saveEvent();
    });
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console