responsive.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**
  2. * Copyright © Magento, Inc. All rights reserved.
  3. * See COPYING.txt for license details.
  4. */
  5. define([
  6. 'jquery',
  7. 'matchMedia',
  8. 'mage/tabs',
  9. 'domReady!'
  10. ], function ($, mediaCheck) {
  11. 'use strict';
  12. mediaCheck({
  13. media: '(min-width: 768px)',
  14. /**
  15. * Switch to Desktop Version.
  16. */
  17. entry: function () {
  18. var galleryElement;
  19. (function () {
  20. var productInfoMain = $('.product-info-main'),
  21. productInfoAdditional = $('#product-info-additional');
  22. if (productInfoAdditional.length) {
  23. productInfoAdditional.addClass('hidden');
  24. productInfoMain.removeClass('responsive');
  25. }
  26. })();
  27. galleryElement = $('[data-role=media-gallery]');
  28. if (galleryElement.length && galleryElement.data('mageZoom')) {
  29. galleryElement.zoom('enable');
  30. }
  31. if (galleryElement.length && galleryElement.data('mageGallery')) {
  32. galleryElement.gallery('option', 'disableLinks', true);
  33. galleryElement.gallery('option', 'showNav', false);
  34. galleryElement.gallery('option', 'showThumbs', true);
  35. }
  36. },
  37. /**
  38. * Switch to Mobile Version.
  39. */
  40. exit: function () {
  41. var galleryElement;
  42. $('.action.toggle.checkout.progress').on('click.gotoCheckoutProgress', function () {
  43. var myWrapper = '#checkout-progress-wrapper';
  44. scrollTo(myWrapper + ' .title');
  45. $(myWrapper + ' .title').addClass('active');
  46. $(myWrapper + ' .content').show();
  47. });
  48. $('body').on('click.checkoutProgress', '#checkout-progress-wrapper .title', function () {
  49. $(this).toggleClass('active');
  50. $('#checkout-progress-wrapper .content').toggle();
  51. });
  52. galleryElement = $('[data-role=media-gallery]');
  53. setTimeout(function () {
  54. if (galleryElement.length && galleryElement.data('mageZoom')) {
  55. galleryElement.zoom('disable');
  56. }
  57. if (galleryElement.length && galleryElement.data('mageGallery')) {
  58. galleryElement.gallery('option', 'disableLinks', false);
  59. galleryElement.gallery('option', 'showNav', true);
  60. galleryElement.gallery('option', 'showThumbs', false);
  61. }
  62. }, 2000);
  63. }
  64. });
  65. });