MSV FM

dot.antimicrobial@66.96.161.157: ~ $
Path : /hermes/bosweb/b1705/reserva.events/menu/src/js/modules/
File Upload :
Current < : /hermes/bosweb/b1705/reserva.events/menu/src/js/modules/background.js

const Background = {
  init($context) {
    const _ = this

    // Image
    $('.bg-image, .post-wide .post-image, .post.single .post-image', $context || 'html').each(function() {
      const $self = $(this)
      const src = $self.children('img').attr('src')
      $self
        .css('background-image', 'url(' + src + ')')
        .children('img')
        .hide()
    })

    // Video
    $('.bg-video', $context || 'html').each(function() {
      const $self = $(this)
      setTimeout(() => {
        const $video = $(`
          <video muted playsinline autoplay loop preload="none">
            <source src="${$self.data('src')}" type="${$self.data('type')}">
          </video>
        `)
        $video.appendTo($self)
      }, 500)
    })
  }
}

export default Background