Menu icon Foundation
User External JS Files in Foundation-CLI

I am trying to use an external jQuery file (vidbacking) to add background video to a div. But I don't know where to add the js file inside my project and then how to use it. Can someone please help me on this one?

I googled a lot but couldn't find anything that worked. 

javascriptexternal jsjquery

I am trying to use an external jQuery file (vidbacking) to add background video to a div. But I don't know where to add the js file inside my project and then how to use it. Can someone please help me on this one?

I googled a lot but couldn't find anything that worked. 

Kevin Ball 12 days ago

Hi Rahul - if you're using foundation CLI, I'm guessing that you're installing the ZURB stack. If so, you'll want to put your file into the javascript folder, and then 'require' it into your app.js file, e.g.

import $ from 'jquery';

require('what-input');
window.$ = $;

// YOUR PLUGIN
require('./my-jquery-plugin');

For more detail, check out the javascript section of this comprehensive walkthrough of the ZURB stack.