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

tutzya,
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title> - jsFiddle demo</title>

  <script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script>

  <style type='text/css'>
    .view-source {
  margin-bottom: 10px;
}

.hide {
  border: 1px solid #eee;
  border-top: none;
  font-size: 16px;
  padding: 10px;
  display: block;
}

.view-source a:link, .view-source a:visited {
  background: #F3F2EE;
  box-shadow: 1px 1px #ccc;
  border: 5px;
  border: none;
  clear: both;
  color: #000;
  display: block;
  font-size: 16px;
  height: 30px;
  line-height: 30px;
  text-decoration: none;
  padding-left: 10px;
  border: 1px solid #eee;
}

.view-source a:hover ,.view-source a.test{
  background: #eee;
    color: #ffad81;
}

  </style>



<script type='text/javascript'>
$(window).load(function(){
$('.view-source .hide').hide();
    $a = $('.view-source a');
    $a.on('click', function(event) {
      event.preventDefault();
      $a.not(this).removeClass('test').next().slideUp(800);
      $(this).toggleClass('test').next().slideToggle(800);
 });
});

</script>


</head>
<body>
  <div class="view-source">
              <a href="#">My Question 1?</a>
              <div class="hide" style="display: none;">My Answer</div>
            </div>
<div class="view-source">
              <a href="#">My Question 2?</a>
              <div class="hide" style="display: none;">My Answer</div>
            </div>

</body>


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