How to embed files hosted on Github

2a. Embed it in your project (JavaScript/CSS)

  • If it is a .js file,

<script src="https://cdn.rawgit.com/alvarotrigo/fullPage.js/master/jquery.fullPage.min.js"></script>

  • If it is a .css file,

<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/alvarotrigo/fullPage.js/master/jquery.fullPage.css" />

  • Paste it in Site Settings > Custom Code > Footer Code OR
    Page Settings > Custom Code > Footer Code

2a1. If your jQuery plugin has additional options, follow their documentation and put additional custom code after the above.

  • If you need help with further plugin customization or advanced usage, feel free to contact me at http://webflowexpert.com

2b. Embed it in your project (HTML)

  • If it is a document file (like .html or .txt or .xml), you need to use jQuery to insert the content.

      <div id="ajaxContent"></div>
      <script>
      var Webflow = Webflow || [];
      Webflow.push(function() {
        $.get('https://cdn.rawgit.com/alvarotrigo/fullPage.js/master/examples/simple.html', function(data) {
          $('#ajaxContent').append(data);
        });
      });
      </script>
    
  • Paste it in an embed code component. If you have multiple, append numbers at the end of ajaxContent on line 1 and 6.

  • Do note that JavaScript in the file will not be executed unless you know what to do.

7 Likes