Показать сообщение отдельно
  #12 (permalink)  
Старый 18.06.2017, 23:14
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,103

Alessio18911,

<!DOCTYPE html>

<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
.page {
  position: relative;
  width: 400px;
  height: 250px;
  outline: 1px solid orange;
  background-size: cover;
   background-repeat: no-repeat;
}

.bg1 {
  background-image: url("http://hd4desktop.online/images/m/a-squirrel-408002.jpg");
}

.bg2 {
  background-image: url("http://www.nicefotos.ru/img/picture/May/30/f5cc5821bbc50c0920bc86fa65d9cb4c/mini_1.jpg");
}

.bg3 {
  background-image: url("http://cybercomnet.fr/www/wallpaper/_data/i/galleries/Animaux/Lapin/Lapin-8-cu_s9999x200.jpg");
}

.radio-controls {
  position: absolute;
  bottom: 0;
  left: 50%;
  margin-left: -55px;
  width: 110px;
  height: 50px;
  text-align: center;
  line-height: 65px;
  outline: 1px solid red;
}

label {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: dodgerblue;
  background-clip: padding-box;
  border: 5px solid transparent;
  border-radius: 50%;
  box-shadow: 0 0 2px 1px dodgerblue;
}

  </style>


  <script>
window.addEventListener('DOMContentLoaded', function() {
 var page = document.querySelector('.page'),
     label = page.querySelectorAll('label');
 [].forEach.call(label, function(item, i) {
         item.addEventListener('click', function() {
            page.className = "page bg"+ (i+1)
         });
     });
    });
  </script>
</head>

<body>
<div class="page bg1">
 <div class="radio-controls">
 <label class="label" for="radio1"></label>
 <label class="label" for="radio2"></label>
 <label class="label" for="radio3"></label>
 </div>
 </div>

</body>
</html>

Последний раз редактировалось рони, 18.06.2017 в 23:32. Причина: убрал jquery
Ответить с цитированием