Safari image overlapping issue - html

Having a weird css image issue with Safari, and haven't been able to find anything regarding this online anywhere.
Each jewellery piece has a small gallery of thumbnails underneath it. If there's more thumbnails than can fit in that space, I've set up JS to have them slide back and forth by adjusting the left margin of the outer div (a lot like smoothdivscroll, but not as complicated).
In Safari for some reason, the first image in the little thumbnail gallery is remaining static while the others scroll over it. looks really crap. And I can't figure why. Is it maybe a bug in Safari?
I do feel like it's a CSS problem, because before adding this sliding feature, we just had a limit to only 5 images and they would load overlapped and distorted in Safari as well...
http://jeandousset.com/jewellery/engagement-rings/
Sample HTML:
<div class="span12 offset6 product-images-container" style="margin-left: 140px;">
<div class="product-zoom-container">
<img id="eva-main-image" class="main-image" src="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-round-cut-diamond-front.jpg" data-post-id="530" title="eva-engagement-ring-cushion-cut-diamond-angle-" alt="">
</div>
<div id="eva-gallery" class="product-gallery text-center">
<div class="scroll-products-right"></div>
<div class="scroll-products-left"></div>
<div class="scrollable-area">
<div class="product-gallery-inner" style="width: 420px; margin-left: -30px;">
<a href="#" class="product-thumbnail" data-image="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-cushion-cut-diamond-angle-.jpg" data-post-id="530">
<img src="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-cushion-cut-diamond-angle-.jpg" title="eva-engagement-ring-cushion-cut-diamond-angle-" alt="">
</a>
<a href="#" class="product-thumbnail" data-image="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-cushion-cut-diamond-under.jpg" data-post-id="530">
<img src="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-cushion-cut-diamond-under.jpg" title="eva-engagement-ring-cushion-cut-diamond-under" alt="">
</a>
<a href="#" class="product-thumbnail" data-image="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-cushion-cut-diamond-angle.jpg" data-post-id="530">
<img src="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-cushion-cut-diamond-angle.jpg" title="eva-engagement-ring-cushion-cut-diamond-angle" alt=""></a>
<a href="#" class="product-thumbnail active" data-image="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-round-cut-diamond-front.jpg" data-post-id="530">
<img src="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-round-cut-diamond-front.jpg" title="eva-engagement-ring-round-cut-diamond-front" alt="">
</a>
<a href="#" class="product-thumbnail" data-image="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-cushion-cut-diamond-turned-profile.jpg" data-post-id="530">
<img src="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-cushion-cut-diamond-turned-profile.jpg" title="eva-engagement-ring-cushion-cut-diamond-turned-profile" alt="">
</a>
<a href="#" class="product-thumbnail" data-image="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-asscher-cut-diamond-angle.jpg" data-post-id="530">
<img src="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-asscher-cut-diamond-angle.jpg" title="eva-engagement-ring-asscher-cut-diamond-angle" alt="">
</a>
<a href="#" class="product-thumbnail" data-image="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-asscher-cut-diamond-angle.jpg" data-post-id="530">
<img src="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-asscher-cut-diamond-angle.jpg" title="eva-engagement-ring-asscher-cut-diamond-angle" alt="">
</a>
<a href="#" class="product-thumbnail" data-image="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-asscher-cut-diamond-angle.jpg" data-post-id="530">
<img src="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-asscher-cut-diamond-angle.jpg" title="eva-engagement-ring-asscher-cut-diamond-angle" alt="">
</a>
<a href="#" class="product-thumbnail" data-image="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-asscher-cut-diamond-angle.jpg" data-post-id="530">
<img src="http://doussetwp.loc/wp-content/uploads/2013/07/eva-engagement-ring-asscher-cut-diamond-angle.jpg" title="eva-engagement-ring-asscher-cut-diamond-angle" alt="">
</a>
</div>
</div>
</div>
CSS:
.product-gallery {
*zoom: 1;
max-height: 70px;
position: relative;
margin-left: auto;
margin-right: auto;
}
.product-gallery:before,
.product-gallery:after {
display: table;
content: "";
line-height: 0;
}
.product-gallery:after {
clear: both
}
.product-gallery .scrollable-area {
overflow: hidden;
position: relative;
margin-left: auto;
margin-right: auto;
width: 85%;
}
.product-gallery .scroll-products-right,
.product-gallery .scroll-products-left {
position: absolute;
width: 30px;
height: 100%;
background: url(./../img/arrow-small-left.png) center center no-repeat #fff;
background-color: rgba(255,255,255,0.6);
top: 0;
left: 0;
z-index: 20;
opacity: .6;
filter: alpha(opacity=60);
}
.product-gallery .scroll-products-right:hover,
.product-gallery .scroll-products-left:hover {
cursor: pointer !important;
background-color: rgba(255,255,255,0.8);
opacity: 1;
filter: alpha(opacity=100);
}
.product-gallery .scroll-products-right {
right: 0;
left: auto;
background: url(./../img/arrow-small-right.png) center center no-repeat #fff;
background-color: rgba(255,255,255,0.6);
}
.product-gallery .product-thumbnail {
float: left;
max-width: 70px;
opacity: .5;
filter: alpha(opacity=50);
}
.product-gallery .product-thumbnail.active {
opacity: 1;
filter: alpha(opacity=100);
}
.product-gallery .product-thumbnail:before,
.product-gallery .product-thumbnail:after {
content: ""
}
JS:
Dousset.product = {
currentWindowWidthMin: null,
currentInterval: null,
init: function () {
$('#wrapper').on('click', '.product-thumbnail', Dousset.product.thumbClicked);
// $('.product-thumbnail').css({
// 'float': 'none',
// 'display': 'inline-block'
// });
$('#wrapper').on('mousedown', '.scroll-products-right', Dousset.product.scrollThumbsLeft);
$('#wrapper').on('mousedown', '.scroll-products-left', Dousset.product.scrollThumbsRight);
$('#wrapper').on('mouseup', '.scroll-products-left, .scroll-products-right', function(e){
clearTimeout(Dousset.product.currentInterval);
Dousset.product.currentInterval = null;
});
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
$('#wrapper').on('click', '.scroll-products-right', Dousset.product.scrollThumbsLeftBatch);
$('#wrapper').on('click', '.scroll-products-left', Dousset.product.scrollThumbsRightBatch);
}
Dousset.product.setCurrentWindowWidthMin();
$(window).resize(Dousset.product.windowResized);
},
thumbClicked: function (e) {
e.preventDefault();
if (!$(this).hasClass('active')) {
var postId = $(this).data('post-id');
var newImg = $(this).data('image');
$('.main-image[data-post-id="'+postId+'"]').attr('src', newImg);
$('.product-thumbnail[data-post-id="'+postId+'"]').removeClass('active');
$(this).addClass('active');
}
},
scrollThumbsLeft: function (e) {
var $inner = $(this).siblings('.scrollable-area').find('.product-gallery-inner');
var maxMargin = $inner.width() - $(this).siblings('.scrollable-area').width();
Dousset.product.currentInterval = setInterval(function(){
if (parseInt($inner.css('margin-left'),10) >= -maxMargin) {
$inner.css({
'margin-left' : '-=1'
});
}
},10);
},
scrollThumbsRight: function (e) {
var $inner = $(this).siblings('.scrollable-area').find('.product-gallery-inner');
Dousset.product.currentInterval = setInterval(function(){
if (parseInt($inner.css('margin-left'),10) <= 0 ) {
$inner.css({
'margin-left' : '+=1'
});
}
},10);
},
scrollThumbsLeftBatch: function (e) {
var $inner = $(this).siblings('.scrollable-area').find('.product-gallery-inner');
var maxMargin = $inner.width() - $(this).siblings('.scrollable-area').width();
if (parseInt($inner.css('margin-left'),10) >= -maxMargin) {
$inner.animate({
'margin-left' : '-=70'
});
}
},
scrollThumbsRightBatch: function (e) {
var $inner = $(this).siblings('.scrollable-area').find('.product-gallery-inner');
if (parseInt($inner.css('margin-left'),10) <= 0 ) {
$inner.animate({
'margin-left' : '+=70'
});
}
},
setCurrentWindowWidthMin: function () {
Dousset.product.currentWindowWidthMin = $( window ).width() > 979 ? 980 : $( window ).width() > 767 ? 768 : 480;
},
windowResized: function () {
var oldWinMin = Dousset.product.currentWindowWidthMin;
Dousset.product.setCurrentWindowWidthMin();
}
}
$(document).ready(function(){
Dousset.product.init();
});

I can't say why this worked, or if it was only this, but I added a width and height to the tags, and moved the animation to css3 instead of jQuery.
That seemed to do the trick. You can visit the link above to see.
Thanks to anyone for trying.
And thanks to #JoshC for making those code edits.

Related

macOS Monterey switching tab text color

I recently updated to Monterey and found out bug in my website. So, I have three tabs, while switching between them other one losses their text, text becomes white, I dunno.
Before, at safari 15.0 all was okay. But Monterey has safari 16.0
Tab is a hyperlink tag
I already searched through different whole css styles:
:webkit-any-link,
::selection,
a:hover,
a:active
Moreover, when I turn off one of the styles, text appears devtools screen if helps
const prodctTabHeadlineBtn = document.querySelectorAll('.device-proudct-tabs__headline-item');
const productTabContent = document.querySelectorAll('.device-proudct-tab');
prodctTabHeadlineBtn.forEach(function (item) {
item.addEventListener('click', function () {
event.preventDefault();
let currentHeadlineBtn = item;
let tabId = currentHeadlineBtn.getAttribute('data-tab');
let cuttentTab = document.querySelector(tabId);
prodctTabHeadlineBtn.forEach(function (item) {
item.classList.remove('active');
});
productTabContent.forEach(function (item) {
item.classList.remove('active');
});
currentHeadlineBtn.classList.add('active');
cuttentTab.classList.add('active');
});
document.querySelector('.device-proudct-tabs__headline-item').click();
});
.device-proudct-tabs__headline-item {
width: 33.3333%;
padding: 25px 0;
position: relative;
font-size: 21px;
font-weight: 700;
color: #706C79;
text-align: center;
transition: all .2s linear;
}
.device-proudct-tabs__headline-item.active {
color: #34303d;
}
.device-proudct-tabs__headline-item.active::after {
content: '';
display: block;
width: 100%;
height: 3px;
background: #00d1d2;
position: absolute;
left: 0;
bottom: 0;
transition: all .2s linear;
}
.device-proudct-tabs__headline-item:hover {
color: #34303d;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="device-proudct-tabs__headline">
<a class="device-proudct-tabs__headline-item" data-tab="#tab_1" href="#">
text
</a>
<a class="device-proudct-tabs__headline-item" data-tab="#tab_2" href="#">
text
</a>
<a class="device-proudct-tabs__headline-item d-none" data-tab="#tab_3" href="#">
text
</a>
<a class="device-proudct-tabs__headline-item active" data-tab="#tab_4" href="#">
text
</a>
</div>

Modal image in wp plugin

I'm using the plugin "ninja tables pro" to display a long table.
As i use the google sheets importation functionality, i can't use the "lightbox" option.
So i try to create a popup with jquery.
The difficulty is to take the current cliked image to display her without have the prévious one
here is my code :
var btnClose = document.getElementById('btnClose');
btnClose.addEventListener('click',closeModal);
function closeModal() {
overlay.style.display='none';
}
$(document).ready(function() {
$('.img').each(function() {
var currentImage = $(this);
$(this).on("click", function(){
$(".popup").append("<img class='img' src='" + currentImage.attr("src") + "' alt='' width='400' height='400'>");
$("#popup").remove("<img class='img' src='" + currentImage.attr("src") + "' alt='' width='400' height='400'>");
$("#overlay").css("display", "block");
});
});
});
.overlay {
position: fixed;
left: 0px;
top:0px;
background-color: rgba(0,0 ,0 , 0.5);
width: 100%;
height: 100%;
z-index:36;
display:none;
padding: 500px;
}
.popup{
margin-left: auto;
margin-right: auto;
margin-top: -240px !important;
width : 70%;
background-color: rgb(243, 243, 243);
padding: 1em;
box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);
border-radius: 5px;
}
.btnClose {
float: right;
font-size:16pt;
cursor: pointer;
color: rgb(26, 26, 26);
}
<img class="img" src="{{row.photoduproduit}}" alt="" width="150" height="150" class="aligncenter size-full wp-image-5505"/>
<div id="overlay" class="overlay">
<div id="popup" class="popup">
<span id="btnClose" class="btnClose">×</span>
(the img with the "{{rowphotoduproduit}}" is to have the src of the pic in the table)
The problem here is that all time i click on a pic, it show it but with the previous one.
Do you have a idea ?
Thanks you in advance
You can just use empty method from jquery to 'empty' the popup before appending the image.
Other Changes made :
add closing </div> tag to div overlay and div popup
remove duplicate class attribute on img
changed overlay in closeModal to $('.overlay')
changed the use of style.display to jquery hide/show methods
made use of template strings instead of concatenation for new
image element
UPDATE : Added a solution with clone and commented out the first solution
var btnClose = document.getElementById('btnClose');
btnClose.addEventListener('click', closeModal);
function closeModal() {
$("#overlay").hide();
}
$(document).ready(function() {
$('.img').each(function() {
const currentImage = $(this);
currentImage.on("click", function() {
$('.popup').empty();
// creating a new image with same src
// const imageToAdd = `<img class='img' src=${currentImage.attr('src')} alt='' width='400' height='400' />`
// $('.popup').append(imageToAdd)
// clone image and change width/height
const clonedImage = $( currentImage ).clone().appendTo( ".popup" );
clonedImage.css({
'width' : '400px',
'height' : '400px'
});
$("#overlay").show();
});
});
});
.overlay {
position: fixed;
left: 0px;
top: 0px;
background-color: rgba(0, 0, 0, 0.5);
width: 100%;
height: 100%;
z-index: 36;
display: none;
padding: 500px;
}
.popup {
margin-left: auto;
margin-right: auto;
width: 70%;
background-color: rgb(243, 243, 243);
padding: 1em;
box-shadow: 0 15px 20px rgba(0, 0, 0, 0.3);
border-radius: 5px;
}
.btnClose {
font-size: 16pt;
cursor: pointer;
color: rgb(26, 26, 26);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<img class="img" src="https://via.placeholder.com/150" alt="" width="150" height="150" />
<img class="img" src="https://via.placeholder.com/350" alt="" width="150" height="150" />
<div class="overlay">
</div>
<div id="popup" class="popup"></div>
<span id="btnClose" class="btnClose">×</span>

How to create right and left buttons to move product carousel in jQuery?

Investigating and, putting together my code little by little, I have achieved a carousel with the mouseup function that allows me to move the products by pressing the left button of the mouse without releasing it, so far it goes very well, well sometimes it remains as stalled, that is, without having pressed if I move the pointer moves the products.
What I want to achieve in my code is to be able to integrate two buttons, one right and one left, to also be able to move the products of the carousel in that way. How can I achieve it, can you explain to me?
var direction_slider = "up";
var current_step = 0;
var scroll_product = false;
var scroll = -1;
$(function(){
// vars for clients list carousel
var $product_carousel = $('.slider');
var products = $product_carousel.children().length;
var product_width = (products * 140); // 140px width for each client item
$product_carousel.css('width',product_width);
var rotating = true;
//var product_speed = 1800;
//var see_products = setInterval(rotateClients, product_speed);
$(document).on({
mouseenter: function(){
rotating = false; // turn off rotation when hovering
},
mouseleave: function(){
rotating = true;
}
}, '#carousel');
$product_carousel.on("mousedown", function(e) {
scroll_product = true;
scroll = e.pageX;
event.preventDefault();
}).on("mouseup", function(e) {
scroll_product = false;
var num = Math.floor(Math.abs(scroll - e.pageX) / 140);
var dir = scroll - e.pageX < 0 ? "up" : "down";
for (var x = 0; x < num; x++) {
var $first = $('.slider .item:first');
var $last = $('.slider .item:last');
if (dir == "up") {
$last.prependTo(".slider");
} else {
$first.appendTo(".slider");
}
}
$(".slider").css("transform", "translate(0, 0)")
}).on("mousemove", function(e) {
if (scroll_product) {
$(".slider").css("transform", "translate(" + ( e.pageX - scroll ) +"px, 0)")
}
});
});
.carousel {
margin: 0 auto;
padding: 1em;
width: 100%;
max-width: 1170px;
margin-left: auto;
overflow: hidden;
}
.slider {
width: 100% !important;
display: flex;
}
.item {
display: inline-table;
width: 280px;
height: 325px;
margin: 0.5em;
border: 1px solid #ccc;
}
a {
color: #8563CF;
text-decoration: none;
font-weight: 100;
}
.thumbnail {
height: 150px;
position: relative;
}
.thumbnail img {
height: 100%;
width: 100%;
object-fit: cover;
object-position: 50% 15%;
}
img {
border: 0;
height: auto;
max-width: 100%;
vertical-align: middle;
}
.p1em {
padding: 1em;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<div class="carousel">
<div id="carousel">
<div class="slider" style="width: 280px; transform: translate(0px, 0px);">
<div class="item product">
<a href="#">
<div class="thumbnail image">
<img src="https://i.ytimg.com/vi/ZxrUVuOqsy0/maxresdefault.jpg">
</div>
<div class="box p1em">
<div class="heading ellipsis">
<h3>Prueba 1</h3>
</div>
<div class="author">
<span></span>
</div>
<div class="price right">
<p>
<label></label>
<em class="item-price">$40.130,00</em>
</p>
</div>
</div>
</a>
</div> <div class="item product">
<a href="#">
<div class="thumbnail image">
<img src="https://i.ytimg.com/vi/ZxrUVuOqsy0/maxresdefault.jpg">
</div>
<div class="box p1em">
<div class="heading ellipsis">
<h3>Curso de PHP 8 básico, intermedio y, avanzado. </h3>
</div>
<div class="author">
<span>Acaded</span>
</div>
<div class="purchased items-center">
<button>Ir al curso</button>
</div>
</div>
</a>
</div>
</div>
</div>
</div>
The goal here is to shift the order of elements to the left or right. With jQuery this is exceptionally easy.
The logic is as so:
To shift the order to the right, select the last item, delete it, then insert before the first item
To shift the order to the left, select the first item, delete it, then insert after the last item
To achieve this, we attach a click event listener to each respective button. We select all the slider items with the selector $('.item.product'), use last() and first() to get the first and last items, and the remove() function to delete the element. Then, to reorder, we use jQuery's insertBefore() and insertAfter().
This is the result:
$('#right').click(function() {
$('.item.product').last().remove().insertBefore($('.item.product').first());
})
$('#left').click(function() {
$('.item.product').first().remove().insertAfter($('.item.product').last());
})
And the rest is just a matter of styling (note: uses Material Icons for the arrow icons). Define two button elements;
<button id="left" class="nav-btn"><i class="material-icons">chevron_left</i></button>
<button id="right" class="nav-btn"><i class="material-icons">chevron_right</i></button>
The "chevron_right" and "chevron_left" are icon names | List of Icons
Set their position to fixed so that their position isn't lost when the user scrolls. Set the top attribute to calc(50vh - 50px), where 50vh is half the height of the viewport and 50px is the height of the button (to make it exactly in the "center").
A full example (best viewed in full page mode):
var direction_slider = "up";
var current_step = 0;
var scroll_product = false;
var scroll = -1;
$(function() {
$('#right').click(function() {
$('.item.product').last().remove().insertBefore($('.item.product').first());
})
$('#left').click(function() {
$('.item.product').first().remove().insertAfter($('.item.product').last());
})
var $product_carousel = $('.slider');
var products = $product_carousel.children().length;
var product_width = (products * 140);
$product_carousel.css('width', product_width);
var rotating = true;
$(document).on({
mouseenter: function() {
rotating = false;
},
mouseleave: function() {
rotating = true;
}
}, '#carousel');
$product_carousel.on("mousedown", function(e) {
scroll_product = true;
scroll = e.pageX;
event.preventDefault();
}).on("mouseup", function(e) {
scroll_product = false;
var num = Math.floor(Math.abs(scroll - e.pageX) / 140);
var dir = scroll - e.pageX < 0 ? "up" : "down";
for (var x = 0; x < num; x++) {
var $first = $('.slider .item:first');
var $last = $('.slider .item:last');
if (dir == "up") {
$last.prependTo(".slider");
} else {
$first.appendTo(".slider");
}
}
$(".slider").css("transform", "translate(0, 0)")
}).on("mousemove", function(e) {
if (scroll_product) {
$(".slider").css("transform", "translate(" + (e.pageX - scroll) + "px, 0)")
}
});
});
/* button integration styling (start) */
#left {
left: 10px;
}
#right {
right: 10px;
}
.nav-btn {
position: fixed;
top: calc(50vh - 50px);
z-index: 100;
z-index: 100;
height: 50px;
width: 50px;
border-radius: 50%;
cursor: pointer;
background-color: white;
box-shadow: 0 0 1px black;
transition: 0.2s;
}
.nav-btn:hover {
background-color: #d1d1d1;
}
/* button integration styling (end) */
.carousel {
margin: 0 auto;
padding: 1em;
width: 100%;
max-width: 1170px;
margin-left: auto;
overflow: hidden;
}
.slider {
width: 100% !important;
display: flex;
}
.item {
display: inline-table;
width: 280px;
height: 325px;
margin: 0.5em;
border: 1px solid #ccc;
}
a {
color: #8563CF;
text-decoration: none;
font-weight: 100;
}
.thumbnail {
height: 150px;
position: relative;
}
.thumbnail img {
height: 100%;
width: 100%;
object-fit: cover;
object-position: 50% 15%;
}
img {
border: 0;
height: auto;
max-width: 100%;
vertical-align: middle;
}
.p1em {
padding: 1em;
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<div class="carousel">
<button id="left" class="nav-btn"><i class="material-icons">chevron_left</i></button>
<button id="right" class="nav-btn"><i class="material-icons">chevron_right</i></button>
<div id="carousel">
<div class="slider" style="width: 280px; transform: translate(0px, 0px);">
<div class="item product">
<a href="#">
<div class="thumbnail image">
<img src="https://i.ytimg.com/vi/ZxrUVuOqsy0/maxresdefault.jpg">
</div>
<div class="box p1em">
<div class="heading ellipsis">
<h3>Prueba 1</h3>
</div>
<div class="author">
<span></span>
</div>
<div class="price right">
<p>
<label></label>
<em class="item-price">$40.130,00</em>
</p>
</div>
</div>
</a>
</div>
<div class="item product">
<a href="#">
<div class="thumbnail image">
<img src="https://i.ytimg.com/vi/ZxrUVuOqsy0/maxresdefault.jpg">
</div>
<div class="box p1em">
<div class="heading ellipsis">
<h3>Curso de PHP 8 básico, intermedio y, avanzado. </h3>
</div>
<div class="author">
<span>Acaded</span>
</div>
<div class="purchased items-center">
<button>Ir al curso</button>
</div>
</div>
</a>
</div>
<div class="item product">
<a href="#">
<div class="thumbnail image">
<img src="https://www.gravatar.com/avatar/0fdacb141bca7fa57c392b5f03872176?s=96&d=identicon&r=PG&f=1">
</div>
<div class="box p1em">
<div class="heading ellipsis">
<h3>Spectric</h3>
</div>
<div class="author">
<span>Spectric</span>
</div>
<div class="purchased items-center">
<button>Check out</button>
</div>
</div>
</a>
</div>
</div>
</div>
</div>

How to order pictures in an HTML file

I am currently doing some plots with plotly in Javascript and HTML. I need to add next to the plotly graph 7 pictures.
So far I managed to add the fist picture on the RHS. This picture is 600x400 pixels. But now I want to display the same picture six times below the current one (obviously the picture should be 6 times scaled in order to fit in there).
Unfortunately I don't have any idea how to do it as I don't have any experience with HTML or CSS. I have tried already to create a grid which would contain the images and the graph but everything gets misaligned.
I add the code I have so far:
<!DOCTYPE html>
<html>
<head>
<!-- Plotly.js -->
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<style>
img{
position: relative;
float: right;
border : none;
height: 50vh;
align: "middle";
}
div.myDiv{
position: relative;
border : none;
height: 50vh;
align: "middle";
}
#hoverinfo{
position: relative;
border : none;
background-color: white;
}
</style>
</head>
<body bgcolor="white">
<div>
<img id="image_part" src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<div id="myDiv"></div>
<div id="hoverinfo"></div>
</div>
<script>
var point_x = [1,2,3,4,5,6];
var point_y = [1,2,3,4,5,6];
var colors = [1,1,1,0,0,0];
var i;
var traces = [];
var max_x = Math.max(...point_x.map(Math.abs));
var max_y = Math.max(...point_y.map(Math.abs));
var max_range = Math.max(max_x,max_y);
max_range = max_range + 0.05*max_range;
for (i = 0; i < point_x.length; i++) {
var trace = {
x: [point_x[i]],
y: [point_y[i]],
mode: 'markers',
marker: {color:[colors[i]]},
type: 'scatter'
}
traces.push(trace);
}
var myPlot = document.getElementById('myDiv'),
hoverInfo = document.getElementById('hoverinfo')
data = traces;
layout = {
hovermode:'closest',
showlegend:true,
title:'Hover on Points',
xaxis: {
range: [-max_range,max_range]
},
yaxis: {
range: [-max_range,max_range],
scaleanchor: 'x'
},
aspectratio: {
x: 1,
y: 1
},
height: 1000,
width: 1000
};
Plotly.plot('myDiv', data, layout);
</script>
</body>
</html>
I am also adding a picture explaining what I expect to get.
Thanks in advance!
Description of what I expect to get
EDIT 26/08/2019:
I managed to create the grid as Azzam Asghar suggested, but I am still unable to place the grid in the lower right corner as showed in the sketch I uploaded. I would really appreciate some help, this is my code now:
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<style>
div.gallery-row {
width: 50%;
display: flex;
}
div.gallery img {
width: 50%;
height: auto;
}
div.desc {
padding: 15px;
text-align: right;
}
* {
box-sizing: border-box;
}
.responsive {
padding: 0 3px;
width: 24.99999%;
}
#media only screen and (max-width: 700px) {
.responsive {
width: 49.99999%;
margin: 6px 0;
}
}
#media only screen and (max-width: 500px) {
.responsive {
width: 100%;
}
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
div.myDiv{
position: relative;
border : none;
height: 50vh;
float: left;
}
img{
position: relative;
float: right;
border : none;
height: 50vh;
}
</style>
</head>
<body bgcolor="white">
<img id="image_part" src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<div class="gallery-row">
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Forest" width="150" height="100">
</a>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Northern Lights" width="150" height="100">
</a>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Mountains" width="150" height="100">
</a>
</div>
</div>
</div>
<div class="gallery-row">
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Forest" width="150" height="100">
</a>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Northern Lights" width="150" height="100">
</a>
</div>
</div>
<div class="responsive">
<div class="gallery">
<a target="_blank" href="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg">
<img src="https://freedesignfile.com/upload/2017/05/Sunrise-tropical-island-beach-view-HD-picture-04.jpg" alt="Mountains" width="150" height="100">
</a>
</div>
</div>
</div>
<div id="myDiv"></div>
<script>
var point_x = [1,2,3,4,5,6];
var point_y = [1,2,3,4,5,6];
var colors = [1,1,1,0,0,0];
var i;
var traces = [];
var max_x = Math.max(...point_x.map(Math.abs));
var max_y = Math.max(...point_y.map(Math.abs));
var max_range = Math.max(max_x,max_y);
max_range = max_range + 0.05*max_range;
for (i = 0; i < point_x.length; i++) {
var trace = {
x: [point_x[i]],
y: [point_y[i]],
mode: 'markers',
marker: {color:[colors[i]]},
type: 'scatter'
}
traces.push(trace);
}
var myPlot = document.getElementById('myDiv'),
hoverInfo = document.getElementById('hoverinfo');
var data = traces;
var layout = {
hovermode:'closest',
showlegend:true,
title:'Hover on Points',
xaxis: {
range: [-max_range,max_range]
},
yaxis: {
range: [-max_range,max_range],
scaleanchor: 'x'
},
aspectratio: {
x: 1,
y: 1
},
height: 1000,
width: 1000
};
Plotly.plot('myDiv', data, layout);
</script>
</body>
</html>
How about modifying w3 example of responsive example according to your needs.
Here is a blitz.
So what you need to do is fix height and width of the image(although there are ways you won't have to do this). Than simply do control the width for smaller screens using css media queries.

I am trying to display text over image on more info click

I am trying to display text over image on more info click and hide text from image on hide info button click.
I am developing website in razor. I am trying to display text over image on more info click and hide text from image on hide info button click.
<style>
.portfolioImage {
position: relative;
overflow: hidden;
}
.portfolioImage .footerBar {
position: absolute;
width: 100%;
height: 100%;
position: absolute;
left: 0;
margin-top: -200px;
border-radius: 5px;
}
.portfolioImage:hover .footerBar {
margin-top: 0px;
background-color: #ffb268;
opacity: 0.8;
}
.footerBar {
-webkit-transition: all 0.7s ease;
transition: all 0.7s ease;
}
</style>
<div class="thumbnail" style="padding:0px;height:200px">
<div class="portfolioImage" id="portfolioImage#(i)">
<div class="footerBar" id="footerBar#(i)">
<table class="table rate-info">
<tr>
<td>First Passenger Fare</td>
</tr>
</table>
</div>
<div id="image_frame#(i)" class="image_frame">
<img alt="100%x200" data-src="#(Url.Content("~/Images/van/"+vanImg+".png"))" src="#(Url.Content("~/Images/van/" + vanImg + ".png"))" data-holder-rendered="true" style="height: 200px; width: 100%; display: block;">
</div>
</div>
<div class="col-sm-2">
<a id="btncollapseShow#(i)" name="btncollapse#(i)" onclick="ShowHideRates('#(i)','show')" style="color:#4285f4;font-size:small;cursor:pointer;" class="btnExpand" title="#Global.Translate("More info")"> + </a>
<a id="btncollapseHide#(i)" name="btncollapse#(i)" onclick="ShowHideRates('#(i)','hide')" style="color:#4285f4;font-size:small;cursor:pointer;display:none;" class="btnExpand" title="#Global.Translate("Hide info")"> – </a>
</div>
function ShowHideRates(_cellindex, _showHide) {
var _image_frame = "#image_frame" + _cellindex;
var btncollapseShow = "#btncollapseShow" + _cellindex;
var btncollapseHide = "#btncollapseHide" + _cellindex;
if (_showHide == "show") {
$(btncollapseShow).css({ "display": "none" });
$(btncollapseHide).css({ "display": "block" });
// $(_image_frame).addClass("portfolioImage footerBar").css('margin-top','+200');
} else {
$(btncollapseShow).css({ "display": "block" });
$(btncollapseHide).css({ "display": "none" });
// $(_image_frame).removeClass("footerBar");
}
}