Royal Slider: Play video when clicking anywhere in the preview image

Here is the code I use to play a YouTube or Vimeo video in a Royal Slider gallery when a visitor clicks anywhere in the preview image, and not just when they click the Play button itself:

<script>
jQuery(document).ready(function($) {
    $('.royalSlider').each(function() {
      var slider = $(this);
      $('.rsContainer').click(function() {
        slider.royalSlider('playVideo');
      });
    });
});
</script>

Meet the author

Libby Fisher is an experienced freelance web developer, recently relocated from Seattle to Boston, and passionate about developing websites that are both aesthetically appealing and intuitively usable - or as she prefers: "beautifully effective."