https://casaviva.house/offerte-affit...-appartamenti/ Salve a tutti, sto impazzendo per mettere a punto tutto lo slider presente nel link che vedete qui in alto. C'è anche del codice PHP perchè le immagine vengono caricate in un ciclo ma quello che conta è l HTML ed il CSS:

Codice PHP:
<div class="slider">                    <div class="slides">                        <?php $cont=1$prev=0$next=0;                            foreach ( $post->fotos as $k => $v ) {                                              $img wp_get_attachment_image_src( (string) $vget_option'option_wpmrc_front_imgelenco' ) );                                $img = @reset$img );?>                                                                <div class="slide">                                    <span class="slide__text" id="slides_<?php echo $cont?>">                                        <img id="slides_<?php echo $cont?>" style="border-radius:15px;" src="<?php echo $img?>">                                       </span>                                      <?php                                         $prev $cont 1;                                        $next $cont 1;                                    ?>                                    <?php if($prev != 0){?>                                        <a class="slide__prev" href="#slides__<?php echo $prev?>" title="Prev"></a>                                    <?php ?>                                                             <a class="slide__next" href="#slides__<?php echo $next?>" title="Next"></a>                                </div> 
                                <div class="slider__nav">                                    <!--a class="slider__navlink" href="#slides__<?php //echo $cont ?>"></a>                                    <!--a class="slider__navlink" href="#slides__2"></a>                                    <a class="slider__navlink" href="#slides__3"></a>                                    <a class="slider__navlink" href="#slides__4"></a-->                                </div>                                <?php $cont++;                                                        }?>                    </div>                </div>
Questo è il CSS:

codice:
.slider-container {
  /*background: linear-gradient(
    149deg,
    rgb(247, 0, 255) 0%,
    rgb(255, 145, 0) 100%
  );*/
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.slider {
  width: 500px;
  max-width: 600px;
  height: 400px;
  margin: 20px;
  text-align: center;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
}

.slides {
  display: flex;
  overflow-x: scroll;
  position: relative;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
}

.slide:nth-of-type(even) {
  background-color: rgb(250, 246, 212);
}

.slide {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  width: 100%;
  height: 270px;
  scroll-snap-align: center;
  margin-right: 0px;
  box-sizing: border-box;
  background: white;
  transform-origin: center center;
  transform: scale(1);
}

.slide__text {
  font-size: 40px;
  font-weight: bold;
  font-family: sans-serif;
}

.slide a {
  background: none;
  border: none;
}

a.slide__prev,
.slider::before {
  transform: rotate(135deg);
  -webkit-transform: rotate(135deg);
  left: 25%;
  /*display:none;*/
}

a.slide__next,
.slider::after {
  transform: rotate(-45deg);
  -webkit-transform: rotate(-45deg);
  right: 25%;
  /*display:none;*/
}

.slider::before,
.slider::after,
.slide__prev,
.slide__next {
  position: absolute;
  top: 48%;
  width: 35px;
  height: 35px;
  border: solid black;
  border-width: 0 4px 4px 0;
  padding: 3px;
  box-sizing: border-box;
}

.slider::before,
.slider::after {
  content: "";
  z-index: 1;
  background: none;
  pointer-events: none;
}

.slider__nav {
  box-sizing: border-box;
  position: absolute;
  bottom: 5%;
  left: 50%;
  width: 200px;
  margin-left: -100px;
  text-align: center;
}

.slider__navlink {
  display: inline-block;
  height: 15px;
  width: 15px;
  border-radius: 50%;
  background-color: black;
  margin: 0 10px 0 10px;
}


.read-article{
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 999;
  color: #000;
  background: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: arial;
  text-decoration: none;
  box-shadow: rgb(50 50 93 / 25%) 0 0 100px -20px, rgb(0 0 0 / 30%) 0 0 60px -15px;
}
.read-article:hover{
    background: #d5d5d5;
    box-shadow: rgb(50 50 93 / 25%) 0 0 100px -20px, rgb(0 0 0 / 30%) 0 0 60px 0px;
}
iframe[sandbox] .read-article{
  display: none;
}
Potete controllare tutto con l'Ispeziona Elemento di Chrome
Lo slider con lo scroll funziona: le immagini vengono caricate. Dovrei sistemare 2 cose:
- le frecce devono andare nella direzione dove c'è il link (al centro in verticale dell immagine a sinistra ed a destra)
- Quando clicco sulle frecce devono far scorrere l immagine

Attendo Suggerimenti

Saluti