Skip to content

Commit

Permalink
Re-add correct function & fix breakpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
pxska committed Feb 10, 2022
1 parent afa9428 commit 5aa3cf6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 27 deletions.
30 changes: 17 additions & 13 deletions javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,33 +703,37 @@ MMCQ = (function() {
});
};

var handleProductPageContent = function() {
$(document).ready(function() {
// ===========================================================================
// Change product image position on narrower screens (mobile devices)
// ===========================================================================

var handleProductPageContent = function () {
$(document).ready(function () {
changeProductImagePos();
});

$(window).resize(debounce(function() {
$(window).resize(debounce(function () {
changeProductImagePos();
}, 25));

var changeProductImagePos = function() {
var paroductImage = $('.js-product-page-image');
var paroductImageWrap = $('.js-product-page-image-wrap');
var buyBtnContent = $('.js-buy-btn-content');
var changeProductImagePos = function () {
var productGallery = $('.js-product-gallery');
var productImageContentBox = $('.js-content-item-box');
var productContentRight = $('.js-product-content-right');

if ($('.js-buy-btn-content .edy-buy-button-container').length >= 1) {
if ($( window ).width() <= 752) {
if ($('.js-buy-btn-content .js-product-page-image').length <= 0) {
buyBtnContent.prepend(paroductImage);
if ($(window).width() < 961) {
if ($('.js-buy-btn-content + .js-product-gallery').length === 0) {
productContentRight.append(productGallery);
}
} else {
if ($('.js-product-page-image-wrap .js-product-page-image').length <= 0) {
paroductImageWrap.prepend(paroductImage);
if ($('.js-content-item-box + .js-product-gallery').length === 0) {
productImageContentBox.append(productGallery);
}
}
}
}
}
};

// Initiates the functions when window is resized.
var handleWindowResize = function() {
Expand Down
Loading

0 comments on commit 5aa3cf6

Please sign in to comment.