0

I have two modals with embedded video on this page… http://staging.wenzelspine.com/products

Everything was working fine until I started converting the HTML to Craft templates, but now they are not playing the correct videos… depending on which you click first.

For example, if you load the page and click Play Video under VariLift-LX it is correct, but if you then click Play Video under VariLift-C it plays the VariLift-LX video. If you reload the page and click for VariLift-C first, it plays the correct video.

  • Hi Howard, and welcome to the Craft CMS Stack Exchange site! Can you flesh this question out with your template code, and original HTML too if you think it's relevant? – Matt Stein May 26 '17 at 19:16
2

Don't have enough reps to comment - but it does not seem to be a Craft issue - but rather a Bootstrap modal issue. It seems like when you open the video, it updates the id of the video.

Based on past experiences - I would look into destroying the modal instance and reloading new content in one modal, as opposed to having multiple modal for multiple content.

Update: Just looked a little more into your code and how it's reacting - it seems like on modal close (of either modals), it updates the value of the video embed code to the varilift-lx video.

^ Caused by scripts.js - Line 2172 - 2174

$('.modal').on('hidden.bs.modal', function () {
    $('.video-container iframe').attr("src", $(".video-container iframe").attr("src"));
});

It is grabing the first video container and updating it to that value.

|improve this answer|||||
  • 1
    Normally I'd say "don't comment as an answer", but it appears you've left a legitimate answer. :) – Matt Stein May 26 '17 at 19:45
  • Got it. Created subclasses for .video-container and all is good. – Howard Theriot May 26 '17 at 23:53
  • Hey @HowardTheriot, please consider accepting if JHEUNG's answer was useful. – Matt Stein May 27 '17 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.