product slider dots & complete the look resize
This commit is contained in:
parent
05f1bf9e85
commit
09b9079508
4 changed files with 139 additions and 62 deletions
|
@ -1,36 +1,122 @@
|
||||||
|
/*.product-slider-container {*/
|
||||||
|
/* position: relative;*/
|
||||||
|
/*}*/
|
||||||
|
/**/
|
||||||
|
/*.product-image-slider {*/
|
||||||
|
/* position: relative;*/
|
||||||
|
/* display: flex;*/
|
||||||
|
/* overflow: hidden;*/
|
||||||
|
/* max-width: 600px;*/
|
||||||
|
/* margin: auto;*/
|
||||||
|
/**/
|
||||||
|
/*}*/
|
||||||
|
/**/
|
||||||
|
/*.slider-item {*/
|
||||||
|
/* position: absolute;*/
|
||||||
|
/* opacity: 0;*/
|
||||||
|
/* transition: opacity 0.5s ease-in-out;*/
|
||||||
|
/* width: 100%;*/
|
||||||
|
/* height: auto !important; /* Ensure images fit the aspect ratio */*/
|
||||||
|
/*}*/
|
||||||
|
/**/
|
||||||
|
/*.slider-item.active {*/
|
||||||
|
/* opacity: 1;*/
|
||||||
|
/* position: relative;*/
|
||||||
|
/*}*/
|
||||||
|
/**/
|
||||||
|
/*.slider-item img {*/
|
||||||
|
/* width: 100%;*/
|
||||||
|
/* height: auto !important; /* Stretch to fill the container while maintaining aspect ratio */*/
|
||||||
|
/* object-fit: contain; /* Maintain image aspect ratio within the container */*/
|
||||||
|
/* display: block;*/
|
||||||
|
/*}*/
|
||||||
|
/**/
|
||||||
|
/*.slider-prev, .slider-next {*/
|
||||||
|
/* position: absolute;*/
|
||||||
|
/* top: 10%;*/
|
||||||
|
/* transform: translateY(-10%);*/
|
||||||
|
/* background: none;*/
|
||||||
|
/* color: #424242;*/
|
||||||
|
/* border: none;*/
|
||||||
|
/* background-color: transparent !important;*/
|
||||||
|
/* cursor: pointer;*/
|
||||||
|
/* font-size: 16px;*/
|
||||||
|
/* padding: 0;*/
|
||||||
|
/* z-index: 10;*/
|
||||||
|
/* font-weight: 600;*/
|
||||||
|
/* transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;*/
|
||||||
|
/*}*/
|
||||||
|
/*.slider-prev i.fa-solid.fa-chevron-right,*/
|
||||||
|
/*.slider-next i.fa-solid.fa-chevron-left{*/
|
||||||
|
/* opacity: 0 !important; /* Initially hidden */*/
|
||||||
|
/* padding: 10px !important;*/
|
||||||
|
/*}*/
|
||||||
|
/**/
|
||||||
|
/*.product-slider-container:hover .slider-prev i.fa-solid.fa-chevron-right,*/
|
||||||
|
/*.product-slider-container:hover .slider-prev i.fa-solid.fa-chevron-left{*/
|
||||||
|
/* opacity: 1; /* Show arrows on hover */*/
|
||||||
|
/*}*/
|
||||||
|
/**/
|
||||||
|
/*.slider-prev {*/
|
||||||
|
/* left: 10px;*/
|
||||||
|
/*}*/
|
||||||
|
/**/
|
||||||
|
/*.slider-next {*/
|
||||||
|
/* right: 10px;*/
|
||||||
|
/*}*/
|
||||||
|
/**/
|
||||||
|
/*@media (max-width: 768px) {*/
|
||||||
|
/* .slider-prev,*/
|
||||||
|
/* .slider-next {*/
|
||||||
|
/* opacity: 1; /* Always visible on mobile */*/
|
||||||
|
/* }*/
|
||||||
|
/*}*/
|
||||||
|
/**/
|
||||||
|
/*.slider-prev:hover, .slider-next:hover, .slider-next:focus, .slider-prev:focus {*/
|
||||||
|
/* color: #000000;*/
|
||||||
|
/* background-color: #cc336600;*/
|
||||||
|
/* text-decoration: none;*/
|
||||||
|
/* border: none !important;*/
|
||||||
|
/* outline: none !important;*/
|
||||||
|
/*}*/
|
||||||
|
|
||||||
.product-slider-container {
|
.product-slider-container {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Image slider layout */
|
||||||
.product-image-slider {
|
.product-image-slider {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: block;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
max-width: 600px;
|
max-width: 600px;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Slider item base */
|
||||||
.slider-item {
|
.slider-item {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity 0.5s ease-in-out;
|
transition: opacity 0.5s ease-in-out;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto !important; /* Ensure images fit the aspect ratio */
|
height: auto !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Active image styling */
|
||||||
.slider-item.active {
|
.slider-item.active {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Image fit */
|
||||||
.slider-item img {
|
.slider-item img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto !important; /* Stretch to fill the container while maintaining aspect ratio */
|
height: auto !important;
|
||||||
object-fit: contain; /* Maintain image aspect ratio within the container */
|
object-fit: contain;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Prev/Next Buttons (Desktop only) */
|
||||||
.slider-prev, .slider-next {
|
.slider-prev, .slider-next {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10%;
|
top: 10%;
|
||||||
|
@ -38,7 +124,6 @@
|
||||||
background: none;
|
background: none;
|
||||||
color: #424242;
|
color: #424242;
|
||||||
border: none;
|
border: none;
|
||||||
background-color: transparent !important;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -46,15 +131,16 @@
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
|
transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slider-prev i.fa-solid.fa-chevron-right,
|
.slider-prev i.fa-solid.fa-chevron-right,
|
||||||
.slider-next i.fa-solid.fa-chevron-left {
|
.slider-next i.fa-solid.fa-chevron-left {
|
||||||
opacity: 0 !important; /* Initially hidden */
|
opacity: 0 !important;
|
||||||
padding: 10px !important;
|
padding: 10px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.product-slider-container:hover .slider-prev i.fa-solid.fa-chevron-right,
|
.product-slider-container:hover .slider-prev i.fa-solid.fa-chevron-right,
|
||||||
.product-slider-container:hover .slider-prev i.fa-solid.fa-chevron-left {
|
.product-slider-container:hover .slider-prev i.fa-solid.fa-chevron-left {
|
||||||
opacity: 1; /* Show arrows on hover */
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.slider-prev {
|
.slider-prev {
|
||||||
|
@ -65,14 +151,9 @@
|
||||||
right: 10px;
|
right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
/* Buttons hover */
|
||||||
.slider-prev,
|
.slider-prev:hover, .slider-next:hover,
|
||||||
.slider-next {
|
.slider-next:focus, .slider-prev:focus {
|
||||||
opacity: 1; /* Always visible on mobile */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.slider-prev:hover, .slider-next:hover, .slider-next:focus, .slider-prev:focus {
|
|
||||||
color: #000000;
|
color: #000000;
|
||||||
background-color: #cc336600;
|
background-color: #cc336600;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -80,7 +161,7 @@
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dots */
|
/* Dots below slider */
|
||||||
.slider-dots {
|
.slider-dots {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
@ -90,7 +171,7 @@
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 10px;
|
width: 10px;
|
||||||
height: 10px;
|
height: 10px;
|
||||||
margin: 0 5px;
|
margin: 0 4px;
|
||||||
background-color: #ccc;
|
background-color: #ccc;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
@ -98,7 +179,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.slider-dot.active {
|
.slider-dot.active {
|
||||||
background-color: #333;
|
background-color: #000;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Hide arrows on mobile */
|
/* Hide arrows on mobile */
|
||||||
|
|
|
@ -25,47 +25,38 @@
|
||||||
//});
|
//});
|
||||||
//
|
//
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
$('.product-image-slider').each(function() {
|
$('.product-slider-container').each(function() {
|
||||||
let slider = $(this);
|
const container = $(this);
|
||||||
let items = slider.find('.slider-item');
|
const slider = container.find('.product-image-slider');
|
||||||
|
const items = slider.find('.slider-item');
|
||||||
let currentIndex = 0;
|
let currentIndex = 0;
|
||||||
|
|
||||||
// Add dots container
|
// Hide all except first
|
||||||
let dotsContainer = $('<div class="slider-dots"></div>');
|
items.css({ position: 'absolute', opacity: 0, transition: 'opacity 0.3s ease' });
|
||||||
slider.after(dotsContainer);
|
items.eq(currentIndex).css({ opacity: 1, position: 'relative' });
|
||||||
|
|
||||||
|
// Create and insert dots
|
||||||
|
const dotsContainer = $('<div class="slider-dots"></div>');
|
||||||
items.each(function(i) {
|
items.each(function(i) {
|
||||||
let dot = $('<span class="slider-dot"></span>');
|
const dot = $('<span class="slider-dot"></span>');
|
||||||
if (i === 0) dot.addClass('active');
|
if (i === 0) dot.addClass('active');
|
||||||
dot.on('click', function() {
|
dot.on('click', function() {
|
||||||
currentIndex = i;
|
currentIndex = i;
|
||||||
showSlide(currentIndex);
|
updateSlide();
|
||||||
});
|
});
|
||||||
dotsContainer.append(dot);
|
dotsContainer.append(dot);
|
||||||
});
|
});
|
||||||
|
container.append(dotsContainer);
|
||||||
|
|
||||||
function updateDots(index) {
|
// Slide update function
|
||||||
|
function updateSlide() {
|
||||||
|
items.css({ opacity: 0, position: 'absolute' });
|
||||||
|
items.eq(currentIndex).css({ opacity: 1, position: 'relative' });
|
||||||
dotsContainer.find('.slider-dot').removeClass('active')
|
dotsContainer.find('.slider-dot').removeClass('active')
|
||||||
.eq(index).addClass('active');
|
.eq(currentIndex).addClass('active');
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSlide(index) {
|
// Touch swipe
|
||||||
items.removeClass('active');
|
|
||||||
$(items[index]).addClass('active');
|
|
||||||
updateDots(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Swipe support for mobile
|
|
||||||
let touchStartX = 0;
|
let touchStartX = 0;
|
||||||
let touchEndX = 0;
|
let touchEndX = 0;
|
||||||
|
|
||||||
|
@ -75,23 +66,28 @@ jQuery(document).ready(function($) {
|
||||||
|
|
||||||
slider.on('touchend', function(e) {
|
slider.on('touchend', function(e) {
|
||||||
touchEndX = e.originalEvent.changedTouches[0].clientX;
|
touchEndX = e.originalEvent.changedTouches[0].clientX;
|
||||||
handleSwipe();
|
const delta = touchEndX - touchStartX;
|
||||||
});
|
|
||||||
|
|
||||||
function handleSwipe() {
|
if (Math.abs(delta) > 50) {
|
||||||
let deltaX = touchEndX - touchStartX;
|
if (delta < 0) {
|
||||||
if (Math.abs(deltaX) > 50) {
|
|
||||||
if (deltaX < 0) {
|
|
||||||
currentIndex = (currentIndex + 1) % items.length;
|
currentIndex = (currentIndex + 1) % items.length;
|
||||||
} else {
|
} else {
|
||||||
currentIndex = (currentIndex - 1 + items.length) % items.length;
|
currentIndex = (currentIndex - 1 + items.length) % items.length;
|
||||||
}
|
}
|
||||||
showSlide(currentIndex);
|
updateSlide();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Init
|
// Optional: support prev/next buttons too
|
||||||
showSlide(currentIndex);
|
container.find('.slider-prev').on('click', function() {
|
||||||
|
currentIndex = (currentIndex - 1 + items.length) % items.length;
|
||||||
|
updateSlide();
|
||||||
|
});
|
||||||
|
|
||||||
|
container.find('.slider-next').on('click', function() {
|
||||||
|
currentIndex = (currentIndex + 1) % items.length;
|
||||||
|
updateSlide();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
/**
|
/**
|
||||||
* Define Constants
|
* Define Constants
|
||||||
*/
|
*/
|
||||||
define( 'CHILD_THEME_OONT_THEME_VERSION', '1.3.6' );
|
define( 'CHILD_THEME_OONT_THEME_VERSION', '1.3.7' );
|
||||||
define( 'SOFTOBA_RETURN_POST_TYPE', 'return_request' );
|
define( 'SOFTOBA_RETURN_POST_TYPE', 'return_request' );
|
||||||
define( 'SOFTOBA_EXCHANGE_POST_TYPE', 'exchange_request' );
|
define( 'SOFTOBA_EXCHANGE_POST_TYPE', 'exchange_request' );
|
||||||
define('SOFTOBA_THEME_DIR', get_stylesheet_directory());
|
define('SOFTOBA_THEME_DIR', get_stylesheet_directory());
|
||||||
|
|
|
@ -3,7 +3,7 @@ Theme Name: OONT THEME V last
|
||||||
Author: Brainstorm Force
|
Author: Brainstorm Force
|
||||||
Author URI: http://wpastra.com/about/
|
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!
|
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.6
|
Version: 1.3.7
|
||||||
License: GNU General Public License v2 or later
|
License: GNU General Public License v2 or later
|
||||||
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
Text Domain: oont-theme
|
Text Domain: oont-theme
|
||||||
|
|
Loading…
Reference in a new issue