News Slider

0

I wanted to make a% infinite% co containing news, so I want each image to show a text that in turn is a link to the news to read it in depth.

Here is an example: News page with similar slider

The thing is to make an infinite slider of images, but I do not know how to add the link.

For now I have this.

My HTML:

        <div class="Banner_Noticias">
            <a href="clasificacion.html" id="Enlace1" target="_blank">Enlace noticia</a>
        </div>

My CSS:

.Banner_Noticias{
height: 433px;
width: 650px;

border: solid 15px;
border-color: #FFF;
border-radius: 20px;

margin-left: 40px;


background-size: 100% 100%;    /* Redimensionar imagen :) */

/* Animacion */
animation: Animacion_Banner_Noticias 10s infinite;
}

@keyframes Animacion_Banner_Noticias{
0%, 30%{
    background-image: url(../Img/Imagen1.jpg);
    opacity: 1;        
}

31%, 34%{
    opacity: 0.7;
}

35%, 65% {
    background-image: url(../Img/Imagen2.jpg);
    opacity: 1%;
}

66%, 69%{
    opacity: 0.7%;
}

70%, 100% {
    background-image: url(../Img/Imagen3.jpg);
    opacity: 1%;
}
}

The problem is that this way, all the images contain the same link and obviously this must change according to the image.

I think maybe it should be done for slider , but the truth is that nothing gives the desired result. Is there any property CSS that allows you to enter links? That is, I with CSS I put the image, is there something for links? If not, how would it be done?

Thanks

    
asked by NEA 01.09.2017 в 18:38
source

1 answer

0

here a possible solution of what you are looking for, is just to put a button that has a link to where your news will be, I do not know if your news is stored in database, if so you will have to pass an ID when you press the button to show the corresponding news.

body {
  padding-bottom: 40px;
  color: #5a5a5a;
}


/* CUSTOMIZE THE NAVBAR
-------------------------------------------------- */

/* Special class on .container surrounding .navbar, used for positioning it into place. */
.navbar-wrapper {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 20;
}

/* Flip around the padding for proper display in narrow viewports */
.navbar-wrapper > .container {
  padding-right: 0;
  padding-left: 0;
}
.navbar-wrapper .navbar {
  padding-right: 15px;
  padding-left: 15px;
}
.navbar-wrapper .navbar .container {
  width: auto;
}


/* CUSTOMIZE THE CAROUSEL
-------------------------------------------------- */

/* Carousel base class */
.carousel {
  height: 500px;
  margin-bottom: 60px;
}
/* Since positioning the image, we need to help out the caption */
.carousel-caption {
  z-index: 10;
}

/* Declare heights because of positioning of img element */
.carousel .item {
  height: 500px;
  background-color: #777;
}
.carousel-inner > .item > img {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 100%;
  height: 500px;
}


/* MARKETING CONTENT
-------------------------------------------------- */

/* Center align the text within the three columns below the carousel */
.marketing .col-lg-4 {
  margin-bottom: 20px;
  text-align: center;
}
.marketing h2 {
  font-weight: normal;
}
.marketing .col-lg-4 p {
  margin-right: 10px;
  margin-left: 10px;
}


/* Featurettes
------------------------- */

.featurette-divider {
  margin: 80px 0; /* Space out the Bootstrap <hr> more */
}

/* Thin out the marketing headings */
.featurette-heading {
  font-weight: 300;
  line-height: 1;
  letter-spacing: -1px;
}


/* RESPONSIVE CSS
-------------------------------------------------- */

@media (min-width: 768px) {
  /* Navbar positioning foo */
  .navbar-wrapper {
    margin-top: 20px;
  }
  .navbar-wrapper .container {
    padding-right: 15px;
    padding-left: 15px;
  }
  .navbar-wrapper .navbar {
    padding-right: 0;
    padding-left: 0;
  }

  /* The navbar becomes detached from the top, so we round the corners */
  .navbar-wrapper .navbar {
    border-radius: 4px;
  }

  /* Bump up size of carousel content */
  .carousel-caption p {
    margin-bottom: 20px;
    font-size: 21px;
    line-height: 1.4;
  }

  .featurette-heading {
    font-size: 50px;
  }
}

@media (min-width: 992px) {
  .featurette-heading {
    margin-top: 120px;
  }
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div id="myCarousel" class="carousel slide" data-ride="carousel">
      <!-- Indicators -->
      <ol class="carousel-indicators">
        <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
        <li data-target="#myCarousel" data-slide-to="1"></li>
        <li data-target="#myCarousel" data-slide-to="2"></li>
      </ol>
      <div class="carousel-inner" role="listbox">
        <div class="item active">
          <img class="first-slide" src="https://ununsplash.imgix.net/photo-1416339684178-3a239570f315?q=75&fm=jpg&s=c39d9a3bf66d6566b9608a9f1f3765af" alt="First slide">
          <div class="container">
            <div class="carousel-caption">
              <h1>Muertes Masivas</h1>
              <p>En este dia han muerto 30 personas por mano criminal</p>
              <p><a class="btn btn-lg btn-primary" href="http://es.stackoverflow.com" target="_blank" role="button">Leer Mas</a></p>
            </div>
          </div>
        </div>
        <div class="item">
          <img class="second-slide" src="http://unsplash.s3.amazonaws.com/batch%209/barcelona-boardwalk.jpg" alt="Second slide">
          <div class="container">
            <div class="carousel-caption">
              <h1>La pobreza asesina.</h1>
              <p>La pobreza en el mundo esta creciendo</p>
              <p><a class="btn btn-lg btn-primary" href="https://google.com" target="_blank"  role="button">Leer Mas</a></p>
            </div>
          </div>
        </div>
        <div class="item">
          <img class="third-slide" src="https://ununsplash.imgix.net/photo-1416339134316-0e91dc9ded92?q=75&fm=jpg&s=883a422e10fc4149893984019f63c818" alt="Third slide">
          <div class="container">
            <div class="carousel-caption">
              <h1>No al racismo</h1>
              <p>Personas hacen marcha pacifica en contra del racismo</p>
              <p><a class="btn btn-lg btn-primary" href="https://youtube.com" target="_blank" role="button">Ver Mas</a></p>
            </div>
          </div>
        </div>
      </div>
      <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
        <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
        <span class="sr-only">Anterior</span>
      </a>
      <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
        <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
        <span class="sr-only">Siguiente</span>
      </a>
    </div><!-- /.carousel -->
    
answered by 05.09.2017 в 00:50