Post: Video (YouTube)

less than 1 minute read

YouTube video embed below.

Comments

siva

Thanks for an awesome theme. I’ve really enjoyed getting to use it.

I’m not sure if this is the right place to ask but I’m trying to get a magnific popup working for a youtube iframe.

Neither the magnific youtube popup example nor the code pen example work for me.

I added them directly to a markdown page with the javascript wrapped in script tags.

I’ve tried adding the javascript as a file using head_scripts too.

Any help much appreciated!

Michael Rose

@siva - I suspect if you open your web browser’s web development tools and take a look at the console you’ll see some script errors.

jQuery and the Magnific Popup scripts are loaded at the bottom of every page right before the closing </body> tag. You’re trying to configure MP in your post which is before the core scripts have a chance to load.

You’ll need to add your custom scripts after those. Couple of ways you can do that depending on how you’re using the theme.

  1. Edit _layouts/default.html and place after the scripts.html include.
  2. Edit _includes/scripts.html and place after all scripts.
  3. Use the new footer_scripts config to add your own custom script.
siva

@michael - I went with option 3, adding main.min.js and then my own file to config.yml. Don’t know much about javascript, but I’ve learnt a little now.

Thanks for the quick and detailed response.

Leave a comment

Your email address will not be published. Required fields are marked *

Loading...