JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.js"></script>
CoffeeScript
Course =
init: ->
$('.js-product-overlay').on 'click', (e) =>
@viewProductClickHandler(e, MediaDetection)
@preSelectItemSize()
viewProductClickHandler: (e, mediaDetection) ->
$('.js-product-overlay').fancybox({
href: wishlist_overlay_href
maxWidth: '775px'
minHeight: '495px'
autoCenter: '!isTouch'
height: 'auto'
scrolling: true
fitToView: false
autoSize: false
padding: 0
tpl:
closeBtn: '<a class="fancybox-item modal__close fancybox-close" href="javascript:;">Close</a>'
afterShow: =>
$('.js-fancybox-close').on 'click', (e) ->
e.preventDefault()
$.fancybox.close()
@preSelectItemSize()
})
preSelectItemSize: ->
alert "preSelectItemSize executed."
itemId = $('.modal__product-info').attr('data-item-id')
$("#size-#{itemId}").click()
Course.init()