toddmotto/fluidvids

Exclude this script to specific DIV with grabbing css or id?

Uranbold opened this issue · 2 comments

Hello,

Thanks for your awesome script but there has an one issue here. Any chance to exclude some div and disabling this script specific area?

Thanks again.

Issue: I really need to exlude some areas.

We have selector: iframe. And we are including whole pages for example: selector: #main iframe.

But i really need to exclude this script on specific classes. Example:

selector: #main iframe,
exclude: .skip-video-fluid,

That's it and i really love if you help me. Thanks.

There are two ways to do this, fluidvids (latest version 2.2.0) will add a data-fluidvids attribute (see here) for loaded videos that have been made fluid. Upon requerying fluidvids using fluidvids.apply();, it then re-runs portions of the script to make dynamically created/ajax videos fluid - whilst ignoring ones that have already been rendered.

Option 1: Add the data attribute initially:

<iframe src="//player.vimeo.com/video1" data-fluidvids="loaded"></iframe>

Option 2: Make use of the custom selector better by only applying to vids you need:

<iframe src="//player.vimeo.com/video1" class="makeFluid"></iframe>

<script>
fluidvids.init({
  selector: '.makeFluid',
  players: ['www.youtube.com', 'player.vimeo.com']
});
</script>