Jquery/html5 Modal Video If Autoplay Is Present Play Video
To make it easier to understand please take a look at the Codepen: http://codepen.io/hennysmafter/pen/YqmLKR The codepen is a simpler version of the actual code with only the parts
Solution 1:
You've two somewhat common mistakes: You only used 1 equals sign in the part where you check if autoplay
is true.
A single =
is used for setting variables where as two is used for checking equality.
Edit: You are also attempting to use traditional HTML style attribute checking on a jQuery object. To check an attribute in jQuery, you need to use .attr(attributeName)
Therefore, the correct line would be if ($('.modal-box.opened').find('video').attr(autoplay) == true) {
Post a Comment for "Jquery/html5 Modal Video If Autoplay Is Present Play Video"