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.


                <h2>Bootstrap 3 Modals YouTube Demo</h2>
<!-- Button triggered modal -->
<p><button type="button" 
        class="btn btn-primary btn" 
  Play Video

<!-- Modal HTML -->
<div id="youtubeModal" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h4 class="modal-title">YouTube Video</h4>
      <div class="modal-body">
        <iframe width="560" height="315" src="" frameborder="0" allowfullscreen></iframe>

<hr size="2" />
<p>If you find this demo useful, please consider <a href="" target="_blank">donating $1 dollar</a> (secure PayPal link) for a coffee or purchasing one of my songs from <a href="" target="_blank"></a> or <a href="" target="_blank"></a> for only 0.99 cents each. </p>
<p>Rob uses and recommends <a href="" target="_blank">MochaHost</a>, which provides Web Hosting for as low as $1.95 per month, as well as unlimited emails and disk space!</p>



                body { text-align: center; }



    //Get iframe src attribute value 
    //i.e. YouTube video url
    $("#youtubeModal").on('', function(){
        var modal = $(this),
            video = modal.find('iframe'),
            url   = video.attr('src');
        if (url) {
          //store url for later use
'videoURL', url);
        else {
          //fetch the url from memory
    }).on('', function(){
        //Assign empty url value to the iframe 
        //src attribute when modal is hidden, 
        //which stops the video playback
        $(this).find("iframe").attr('src', '');