var App_Product_View = qs.createObject(); App_Product_View.prototype = { initialize: function (options) { this.options = $.extend(true, { imageContainer: undefined, image: { width: undefined, height: undefined } }, options); this.imageContainer = $('#' + this.options.imageContainer); this.slider = null; this.initSlider(); return this; }, initSlider: function () { var imageCfg = this.options.image; this.imageContainer.css('display', 'block'); this.slider = this.imageContainer.royalSlider({ globalCaption: true, globalCaptionInside: true, numImagesToPreload: 2, fadeinLoadedSlide: false, //imageAlignCenter: true, imageScaleMode: 'fit-if-smaller', imageScalePadding: 0, transitionType:'move', autoScaleSlider: true, // autoScaleSliderWidth: imageCfg.width, autoScaleSliderHeight: imageCfg.height, loop: true, arrowsNav: false, arrowsNavAutoHide: true, arrowsNavHideOnTouch: true, navigateByClick: false, keyboardNavEnabled: false, controlNavigation: 'thumbnails', thumbs: { orientation: 'horizontal', navigation: false, fitInViewport: false, autoCenter: false, spacing: 10 }, fullscreen: { enabled: true, nativeFS: true, buttonFS: true } }).data('royalSlider'); return this; }, initAdditionalImages: function () { if ($('#' + this._imageContainerId).size()) { var imageCount = $('#' + this._imageContainerId).children().size(); Galleria.loadTheme('js/galleria/classic/galleria.classic.js'); Galleria.configure({ showImagenav: (imageCount > 1), thumbnails: (imageCount > 1), debug: false, responsive: true, imageCrop: false, lightbox: true }); Galleria.run('#' + this._imageContainerId); } } }; var App_Product_View_AddItem = { onSuccessCallback: function(formId) { var response = Qs_Form.getFormOption(formId, 'response'); if (response.success === false) { alert('Error while add item to cart'); } else { var messageType = ''; if (response.success.type == 'message') { messageType = 'info'; } else { messageType = 'error'; } var btnSubmit = $('#' + formId + ' #btnSubmit'); btnSubmit.popover({ placement: 'top', html: true, trigger: 'manual', title: 'Shopping Cart ', content: response.success.message, container: 'body' }); btnSubmit.data('popover').options.template = btnSubmit.data('popover').options.template.replace('class="popover"', 'class="popover popover-cart popover-' + messageType + '"'); btnSubmit.on('shown.bs.popover', function () { $('.popover-close, body').bind('click.addToCart', function (ev) { if ('A' == ev.target.tagName || $(ev.target).closest('a.popover-close').length) { ev.stopPropagation(); } else if ($(ev.target).hasClass('popover') || $(ev.target).closest('.popover').length) { return false; // prevent default and stop propagation } $('body').unbind('click.addToCart'); btnSubmit.popover('destroy'); }); }); btnSubmit.popover('show'); if (typeof App_Cart_Small != 'undefined') { App_Cart_Small.reset(); App_Cart_Small.updateQty(response.success.quantity); } if ('message' == response.success.type && response.success.gtmProduct) { lib.Gtm.onAddToCart(response.success.gtmProduct); } } } };