product slider dots & complete the look resize

This commit is contained in:
nomadics9 2025-04-03 08:33:41 +03:00
parent 7aba677491
commit 05f1bf9e85
5 changed files with 112 additions and 9 deletions

View file

@ -89,7 +89,7 @@ p.price {
display: flex;
width: 100%;
height: auto; /* Allow the image to scale proportionally */
max-height: 450px; /* Set a max height for the image (adjust as needed) */
max-height: 1024px; /* Set a max height for the image (adjust as needed) */
max-width: none;
object-fit: cover; /* Crop edges if the image is too tall/wide */
@ -156,9 +156,10 @@ a.ast-loop-product__link h2 {
.woocommerce ul.products li.product {
flex: 0 0 50%; /* Each item takes up 50% of the row */
max-width: 50%; /* Each item takes up 50% of the row */
height: 300px; /* Fixed height for mobile */
height: 272px; /* Fixed height for mobile */
margin-bottom: 15px; /* Add spacing between rows (optional) */
}
.woocommerce ul.products, .woocommerce-page ul.products {
column-gap: 20px !important;
margin-bottom: 0px !important;

View file

@ -79,3 +79,33 @@
border: none !important;
outline: none !important;
}
/* Dots */
.slider-dots {
text-align: center;
margin-top: 10px;
}
.slider-dot {
display: inline-block;
width: 10px;
height: 10px;
margin: 0 5px;
background-color: #ccc;
border-radius: 50%;
cursor: pointer;
transition: background-color 0.3s;
}
.slider-dot.active {
background-color: #333;
}
/* Hide arrows on mobile */
@media (max-width: 768px) {
.slider-prev,
.slider-next {
display: none !important;
}
}

View file

@ -1,25 +1,97 @@
jQuery(document).ready(function ($) {
$('.product-image-slider').each(function () {
//jQuery(document).ready(function ($) {
// $('.product-image-slider').each(function () {
// let slider = $(this);
// let items = slider.find('.slider-item');
// let currentIndex = 0;
//
// function showSlide(index) {
// items.removeClass('active');
// $(items[index]).addClass('active');
// }
//
// slider.siblings('.slider-prev').click(function () {
// currentIndex = (currentIndex > 0) ? currentIndex - 1 : items.length - 1;
// showSlide(currentIndex);
// });
//
// slider.siblings('.slider-next').click(function () {
// currentIndex = (currentIndex < items.length - 1) ? currentIndex + 1 : 0;
// showSlide(currentIndex);
// });
//
// // Initialize
// showSlide(currentIndex);
// });
//});
//
jQuery(document).ready(function($) {
$('.product-image-slider').each(function() {
let slider = $(this);
let items = slider.find('.slider-item');
let currentIndex = 0;
// Add dots container
let dotsContainer = $('<div class="slider-dots"></div>');
slider.after(dotsContainer);
items.each(function(i) {
let dot = $('<span class="slider-dot"></span>');
if (i === 0) dot.addClass('active');
dot.on('click', function() {
currentIndex = i;
showSlide(currentIndex);
});
dotsContainer.append(dot);
});
function updateDots(index) {
dotsContainer.find('.slider-dot').removeClass('active')
.eq(index).addClass('active');
}
function showSlide(index) {
items.removeClass('active');
$(items[index]).addClass('active');
updateDots(index);
}
slider.siblings('.slider-prev').click(function () {
slider.siblings('.slider-prev').click(function() {
currentIndex = (currentIndex > 0) ? currentIndex - 1 : items.length - 1;
showSlide(currentIndex);
});
slider.siblings('.slider-next').click(function () {
slider.siblings('.slider-next').click(function() {
currentIndex = (currentIndex < items.length - 1) ? currentIndex + 1 : 0;
showSlide(currentIndex);
});
// Initialize
// Swipe support for mobile
let touchStartX = 0;
let touchEndX = 0;
slider.on('touchstart', function(e) {
touchStartX = e.originalEvent.touches[0].clientX;
});
slider.on('touchend', function(e) {
touchEndX = e.originalEvent.changedTouches[0].clientX;
handleSwipe();
});
function handleSwipe() {
let deltaX = touchEndX - touchStartX;
if (Math.abs(deltaX) > 50) {
if (deltaX < 0) {
currentIndex = (currentIndex + 1) % items.length;
} else {
currentIndex = (currentIndex - 1 + items.length) % items.length;
}
showSlide(currentIndex);
}
}
// Init
showSlide(currentIndex);
});
});

View file

@ -11,7 +11,7 @@
/**
* Define Constants
*/
define( 'CHILD_THEME_OONT_THEME_VERSION', '1.3.5' );
define( 'CHILD_THEME_OONT_THEME_VERSION', '1.3.6' );
define( 'SOFTOBA_RETURN_POST_TYPE', 'return_request' );
define( 'SOFTOBA_EXCHANGE_POST_TYPE', 'exchange_request' );
define('SOFTOBA_THEME_DIR', get_stylesheet_directory());

View file

@ -3,7 +3,7 @@ Theme Name: OONT THEME V last
Author: Brainstorm Force
Author URI: http://wpastra.com/about/
Description: Astra is the fastest, fully customizable & beautiful theme suitable for blogs, personal portfolios and business websites. It is very lightweight (less than 50KB on frontend) and offers unparalleled speed. Built with SEO in mind, Astra comes with schema.org code integrated so search engines will love your site. Astra offers plenty of sidebar options and widget areas giving you a full control for customizations. Furthermore, we have included special features and templates so feel free to choose any of your favorite page builder plugin to create pages flexibly. Some of the other features: # WooCommerce Ready # Responsive # Compatible with major plugins # Translation Ready # Extendible with premium addons # Regularly updated # Designed, Developed, Maintained & Supported by Brainstorm Force. Looking for a perfect base theme? Look no further. Astra is fast, fully customizable and beautiful theme!
Version: 1.3.5
Version: 1.3.6
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: oont-theme