Please disregard the 'View article...' shown at the bottom of many posts as this is the result of restoring old forum posts from a backup.

Adding a custom script for having vimeo videos responsive


anybody could tell what is wrong with the below footer code where I'm trying to add a custom script in order to make vimeo videos responsive?

expTheme::foot(array("unique"=>"customtheme_c","src"=>THEME_RELATIVE . "js/fluidvids.min.js"));

This has been added to custom theme folder, inside index.php . Exponent is version 2.3.3.

View article...


  • Looking at and, you not only need to load the script, but initialize it with some code (apparently it used to initialize itself?). You'd need to build a string variable, and pass that code string to the foot() method as 'content' also...something like

    <?php $code = "fluidvids.init({
    selector: ['iframe', 'object'], // runs querySelectorAll()
    players: ['', ''] // players to support
    });"; expTheme::foot(array("unique"=>"customtheme_c","src"=>THEME_RELATIVE . "js/fluidvids.min.js","content"=>$code)); ?>

    View article...
  • Hello,
    I got the solution:
    I made a custom view based on text module's single view, and I added on it this code below, in the beginning of the template code.

    {script unique="videoframe" src="`$smarty.const.THEME_RELATIVE`/js/fluidvids.min.js"}
    $(document).ready(function() {
    selector: ['iframe'],
    players: ['', '']
    } );

    And of course I have the file "fluidvids.min.js" indeed located in my custom theme and there in the folder "js".
    This seems to work fine!

    View article...
Sign In or Register to comment.