Created
January 8, 2016 13:30
-
-
Save crmpicco/11e14655a17419983f2f to your computer and use it in GitHub Desktop.
CoffeeScript Scoping Issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ = 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