Skip to content

Instantly share code, notes, and snippets.

@crmpicco
Created January 8, 2016 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crmpicco/11e14655a17419983f2f to your computer and use it in GitHub Desktop.
Save crmpicco/11e14655a17419983f2f to your computer and use it in GitHub Desktop.
CoffeeScript Scoping Issue
$ = window.jQuery = require("jquery")
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()
Course.preSelectItemSize()
})
preSelectItemSize: ->
itemId = $('.modal__product-info').attr('data-item-id')
$('#size-' + itemId).click()
module.exports = Course
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment