Показать сообщение отдельно
  #10 (permalink)  
Старый 11.12.2017, 16:08
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,149

открывашка со сменой фона
artem55555p,


<!DOCTYPE html>

<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  .act .ttl{
     color:  #FF0000;
  }
 .partwr, .deactivated{
display: none;
  }
  .part, .ttlp{
    width: 200px;
    height: 80px;
    background-size: cover;
     float: left;
      margin-left: 10px;
  }
  .ttlp{
    float: none;
     margin-top: 100px;
  }

  </style>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script>
$(function() {
  var part = $(".part"), out = $(".ttlp");
  part.on("click", function() {
    var el = $(this).toggleClass("act");
    part.not(el).removeClass("act");
    var bg = el.attr("style");
    if (el.is(".act")) {
      out.html($(".partwr", el).html()).removeClass("deactivated").attr("style", bg);
    } else {
      out.addClass("deactivated");
    }
  }).eq(0).click();
});
  </script>
</head>

<body>

            <div class="col-md-4 col-sm-4 col-xs-12">
                <div class="wr_part part" style="background: url(https://ds04.infourok.ru/uploads/ex/1274/00028373-8ce7411f/hello_html_4c0f7715.jpg)">
                    <p class="ttl">the_title1</p>
                    <div class="partwr">the_content1</div>
                </div>
            </div>
           <div class="col-md-4 col-sm-4 col-xs-12">
                <div class="wr_part part" style="background: url(https://desktopmania.ru/pics/00/71/21/DesktopMania.ru-71215-300x168.jpg)">
                    <p class="ttl">the_title2</p>
                    <div class="partwr">the_content2</div>
                </div>
            </div>
            <div class="col-md-4 col-sm-4 col-xs-12">
                <div class="wr_part part" style="background: url(http://astromera.ru/wp-content/uploads/2016/02/chistaya-voda-1-450x225.jpg)">
                    <p class="ttl">the_title3</p>
                    <div class="partwr">the_content3</div>
                </div>
            </div><br>
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="ttlp"></div>
            </div>



</body>
</html>
Ответить с цитированием