Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource

JavaScript

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

Packages

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.

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

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                       /*
         * Function to dynamically insert menu items into the Canvas left column
         * navigation area.
         *
         * @param string linkText
         *    The text that will be visible
         * @param string linkHref
         *    The URL that the link should point to. Note, that if this link is 
         *    intended to trigger a modal window, this paramter will be ignored.
         *    You can't have a modal triggerd by an actual URL.
         * @param string icon
         *    A valid icon name from the Canvas icon font.
         *    @see https://champlain.instructure.com/styleguide#icons
         * @param string image
         *    A valid HTML fragment representing an image or SVG icon.
         *    These should be sized around 50x35.
         * @param bool newWindow
         *    True or false, should this link open in a new window.
         *    Note, that if this link should be a modal, this parameter will
         *    be ignored.
         * @param bool isModal
         *    True or false, should this link trigger a modal dialog.
         *    Note that we are relying the jQuery UI Dialog provided by Canvas.
         *    You will need to provide styling in your CSS to match your brand.
         *    @see https://jqueryui.com/dialog/
         * @param string modalContent
         *    This content for the modal dialog. This should be valid HTML.
         * @param object modalOptions
         *    An object of options that are available to the jQuery UI Dialog.
         *    @see https://api.jqueryui.com/dialog/#options
         *
         */

        function ccAddMenuItem (linkText, linkHref, icon, image, newWindow, isModal, modalContent, modalOptions) {
            if($('#menu').length){
              var iconHtml = '',
              itemHtml,
              linkId = linkText.split(' ').join('_'), // Generate the tail end of a unique ID for the element
              modalContentId = 'cc-modal-'+linkId, // generate an ID for the modal content
              menuLinkOpen, // Holds the markup that will go in the menu
              linkHref = isModal ? '#' : linkHref, // If this is going to be a modal, it can't link to a page
              modalOptions = modalOptions ? modalOptions : {}, // Check for modalOptions so we can merge them with defaults
              imageSrc = !image ? false : true;

              // If we are opening this in a new window, and it's not a modal
              // our link has to have target="_blank"
              if(newWindow && !isModal){
                menuLinkOpen = ' <a id="global_nav_' + linkId + '" href="' + linkHref + '" class="ic-app-header__menu-list-link" target="_blank">';
              } else{
                menuLinkOpen = ' <a id="global_nav_' + linkId + '" href="' + linkHref + '" class="ic-app-header__menu-list-link">';
              }

              // If icon and image are supplied don't use either, we shouldn't make the decision.
              // The caller should be smart enough not to pass both.
              if (icon !== '' && !imageSrc) {
                iconHtml = '<i class="' + icon + ' cc-icon"></i> ';
              }
              if(imageSrc !== false && icon == ''){
                iconHtml = '<span class="cc-menu-image">' + image + '</span>';
              }
              itemHtml = '<li class="ic-app-header__menu-list-item">' +
                              menuLinkOpen +
                              iconHtml + '<div class="menu-item__text">' + linkText + '</div>' +
                            ' </a>' +
                        '</li>';
              $('#menu').append(itemHtml);
              // If our menu item made it, and we are adding modal support
              // trigger modal support
              if(isModal && $('#global_nav_'+linkId).length){
                var modalDefaults = {
                    'title'     : 'Menu',
                    'resizable' : false,
                    'width'     : 400
                };
                var modalSettings = $.extend({},modalDefaults,modalOptions);
                // Wrapp the content we received into a correctly styled and ID div
                var modalDiv = '<div id="' + modalContentId + '" style="display:none;" class="cc-help-dialog">' + modalContent + '</div>';
                $('body').append(modalDiv);
                $('#global_nav_'+linkId).on('click',function(){
                    $('#'+modalContentId).dialog(modalSettings);
                });
              }
            }
        }

        function ccAddLibraryLinks(){
             var libraryHelpMenu = ' <ul class="cc-help-dialog-options">'+
            '    <li><a href="http://www.champlain.edu/academics/library/find-books-articles-and-more/find-articles" target="_blank"><span class="name ellipsis text">Research databases</span></a></li>' +
            '    <li><a href="http://www.champlain.edu/academics/library/find-books-articles-and-more/find-books-and-ebooks" target="_blank"><span class="name ellipsis text">Find books and eBooks</span></a></li>' +
            '    <li><a href="http://www.champlain.edu/academics/library/get-help/ask-us" target="_blank"><span class="name ellipsis text">Ask a librarian</span></a></li>' +
            '    <li><a href="http://subjectguides.champlain.edu/content.php?pid=292793&sid=2403742" target="_blank"><span class="name ellipsis text">Get citation help</span></a></li>' +
            '    <li><a href="http://www.champlain.edu/academics/library" target="_blank"><span class="name ellipsis text">Library website</span></a></li>' +
            ' </ul>';

            var modalOptions = {
                'title'     : 'Library Resources',
                'resizable' : false,
                'width'     : 400
            };

            var svgIcon = '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="45px" height="30px" x="0px" y="0px" viewBox="179.2 189.3 389.4 358.5" enable-background="new 179.2 189.3 389.4 358.5" xml:space="preserve"><path fill="#FFFFFF" d="M247.4,189.3c81.6,19.2,118.7,81.2,118.7,81.2v277.2c-41.7-59.9-118.7-84.3-118.7-84.3V461C247.4,461,247.5,189,247.4,189.3z"></path><path fill="#FFFFFF" d="M260.1,530.2c0,0-34.6-17.5-80.8-10.3V247.6h11.4v258.8C190.6,506.2,240.4,505.7,260.1,530.2z"></path><path fill="#FFFFFF" d="M306.8,521.3L306.8,521.3c-18-25.7-75-45.7-75-45.7V219.9l-23.6-9.2V489c0,0,24.3,3,36.4,6.4C286.5,507.2,306.8,521.3,306.8,521.3z"></path><path fill="#FFFFFF" d="M500.5,189.3c-81,25.2-118.7,81.2-118.7,81.2v277.2c41.7-59.9,118.7-84.3,118.7-84.3S500.5,190,500.5,189.3z"></path><path fill="#FFFFFF" d="M487.9,530.2c0,0,34.6-17.5,80.8-10.3V247.6h-11.4v258.8C557.3,506.2,507.6,505.7,487.9,530.2z"></path><path fill="#FFFFFF" d="M441.1,521.3L441.1,521.3c18-25.7,75-45.7,75-45.7V219.9l23.6-9.2V489c0,0-24.3,3-36.4,6.4C461.4,507.2,441.1,521.3,441.1,521.3z"></path></svg>';
            ccAddMenuItem('Library','#','',svgIcon,false,true,libraryHelpMenu,modalOptions);
        }
              
            
!
999px

Console