| 
 | 
	
	
	
	
	
		
	
		
		
		
			
			 
			
				23.04.2017, 21:51
			
			
			
		  
	 | 
 
	
		
		
		
			
			| 
			
				
				
				 Новичок на форуме 
				
				
				
				
	
 
 
 
			 | 
			  | 
			
				
				
					Регистрация: 23.04.2017 
					
					
					
						Сообщений: 8
					 
					
					
			
		
 
		 
		
			 | 
		 
		 
		
	 | 
 
	| 
	
	
		
		
			
			 
				Выджвижной блок
			 
			
		
		
		
		Покажите пожалуйста пример скрипта в котором при нажатии на кнопку выдвигался влево div блок 
		
	
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
	 
		 | 
 
 
	
	
	
		
	
		
		
		
			
			 
			
				23.04.2017, 22:01
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
			
				
				
				 Профессор 
				
				
				
				
	
 
 
 
			 | 
			  | 
			
				
				
					Регистрация: 27.05.2010 
					
					
					
						Сообщений: 33,150
					 
					
					
			
		
 
		 
		
			 | 
		 
		 
		
	 | 
 
	
	
	
		
		
		
		
		AlekSay, 
 конечный результат в html с css можно увидеть? 
Пожалуйста, отформатируйте свой код!
 
Для этого его можно заключить в специальные теги: js/css/html и т.п., например:
 
[js]
... ваш код...
[/js]
 
О том, как вставить в сообщение  исполняемый javascript и html-код, а также о дополнительных возможностях форматирования - читайте  http://javascript.ru/formatting.  
		
	
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
	 
		 | 
 
 
	
	
	
		
	
		
		
		
			
			 
			
				23.04.2017, 22:42
			
			
			
		  
	 | 
 
	
		
		
		
			
			| 
			
				
				
				 Новичок на форуме 
				
				
				
				
	
 
 
 
			 | 
			  | 
			
				
				
					Регистрация: 23.04.2017 
					
					
					
						Сообщений: 8
					 
					
					
			
		
 
		 
		
			 | 
		 
		 
		
	 | 
 
	
	
	
		
		
		
		
		
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
		<title></title>
		<link type="text/css" rel="stylesheet" />
		<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
	</head>
<style>
#block{
   position:absolute;
   left:300px;
   top:50px;
   width:100px;
   height:100px;
   background-color:black;
}
#button{
   position:absolute;
   top:200px;
   width:150px;
   height:100px;
   background-color:red;
}
</style>
<script type="text/javascript">
</script>
<body>
<div id="button"></div>
<div id="block"></div>
</body>
</html>
при нажатии на button block должен влево сдвинуться, а также при повторном нажатии block должен назад сдвинуться  
		
	
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
	 
		 | 
 
 
	
	
	
		
	
		
		
		
			
			 
			
				23.04.2017, 22:56
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
			
				
				
				 Профессор 
				
				
				
				
	
 
 
 
			 | 
			  | 
			
				
				
					Регистрация: 27.05.2010 
					
					
					
						Сообщений: 33,150
					 
					
					
			
		
 
		 
		
			 | 
		 
		 
		
	 | 
 
	
	
	
		
		
		
		
		AlekSay,
  
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
    <title></title>
    <link type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  </head>
<style>
#block{
  position:absolute;
  left:300px;
  top:50px;
  width:100px;
  height:100px;
  background-color:black;
  transition: left .8s ease-in-out;
}
#button{
  position:absolute;
  top:200px;
  width:150px;
  height:100px;
  background-color:red;
}
#block.anime{
  left: 0;
}
</style>
 <script>
$(function() {
    $("#button").on("click", function() {
        $('#block').toggleClass("anime");
})
});
  </script>
<body>
<div id="button"></div>
<div id="block"></div>
</body>
</html>
 
		
	
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
	 
		 | 
 
 
	
	
	
		
	
		
		
		
			
			 
			
				23.04.2017, 23:01
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
			
				
				
				 Профессор 
				
				
				
				
	
 
 
 
			 | 
			  | 
			
				
				
					Регистрация: 27.05.2010 
					
					
					
						Сообщений: 33,150
					 
					
					
			
		
 
		 
		
			 | 
		 
		 
		
	 | 
 
	
	
	
		
		
		
		
		
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
    <title></title>
    <link type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  </head>
<style>
#block{
  position:absolute;
  left:300px;
  top:50px;
  width:100px;
  height:100px;
  background-color:black;
}
#button{
  position:absolute;
  top:200px;
  width:150px;
  height:100px;
  background-color:red;
}
</style>
 <script>
$(function() {
    var n = 1;
    $("#button").on("click", function() {
        var left = 300 * (n^= 1)+"px";
        $('#block').animate({left : left}, 800);
})
});
  </script>
<body>
<div id="button"></div>
<div id="block"></div>
</body>
</html>
 
		
	
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
	 
		 | 
 
 
	
	
	
		
	
		
		
		
			
			 
			
				23.04.2017, 23:35
			
			
			
		  
	 | 
 
	
		
		
		
			
			| 
			
				
				
				 Новичок на форуме 
				
				
				
				
	
 
 
 
			 | 
			  | 
			
				
				
					Регистрация: 23.04.2017 
					
					
					
						Сообщений: 8
					 
					
					
			
		
 
		 
		
			 | 
		 
		 
		
	 | 
 
	| 
	
	
		
		
		
		
		 Спасибо большое 
		
	
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
	 
		 | 
 
 
	
	
	
		
	
		
		
		
			
			 
			
				23.04.2017, 23:41
			
			
			
		  
	 | 
 
	
		
		
		
			
			| 
			
				
				
				 Новичок на форуме 
				
				
				
				
	
 
 
 
			 | 
			  | 
			
				
				
					Регистрация: 23.04.2017 
					
					
					
						Сообщений: 8
					 
					
					
			
		
 
		 
		
			 | 
		 
		 
		
	 | 
 
	
	
	
		
		
		
		
		
	
 
	
		
			Сообщение от рони
			 
		
	 | 
 
	
		
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
    <title></title>
    <link type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  </head>
<style>
#block{
  position:absolute;
  left:300px;
  top:50px;
  width:100px;
  height:100px;
  background-color:black;
}
#button{
  position:absolute;
  top:200px;
  width:150px;
  height:100px;
  background-color:red;
}
</style>
 <script>
$(function() {
    var n = 1;
    $("#button").on("click", function() {
        var left = 300 * (n^= 1)+"px";
        $('#block').animate({left : left}, 800);
})
});
  </script>
<body>
<div id="button"></div>
<div id="block"></div>
</body>
</html>
	 | 
 
	
 
 А это нормально, что оно срабатывает со второго клика  
		
	
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
	 
		 | 
 
 
	
	
	
		
	
		
		
		
			
			 
			
				23.04.2017, 23:46
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
			
				
				
				 Профессор 
				
				
				
				
	
 
 
 
			 | 
			  | 
			
				
				
					Регистрация: 27.05.2010 
					
					
					
						Сообщений: 33,150
					 
					
					
			
		
 
		 
		
			 | 
		 
		 
		
	 | 
 
	
	
	
		
		
		
		
		
	
 
	| 
		
			Сообщение от AlekSay
			
		
	 | 
 
	| 
		что оно срабатывает со второго клика
	 | 
 
	
 
 ??  
		
	
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
	 
		 | 
 
 
	
	
	
		
	
		
		
		
			
			 
			
				23.04.2017, 23:48
			
			
			
		  
	 | 
 
	
		
		
		
			  | 
			
			
				
				
				 Профессор 
				
				
				
				
	
 
 
 
			 | 
			  | 
			
				
				
					Регистрация: 27.05.2010 
					
					
					
						Сообщений: 33,150
					 
					
					
			
		
 
		 
		
			 | 
		 
		 
		
	 | 
 
	
	
	
		
		
		
		
		AlekSay,
  
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
    <title></title>
    <link type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  </head>
<style>
#block{ color : hsla(0, 0%, 100%, 1);
  position:absolute;
  left:300px;
  top:50px;
  width:100px;
  height:100px;
  background-color:black;
}
#button{
  position:absolute;
  top:200px;
  width:150px;
  height:100px;
  background-color:red;
}
</style>
 <script>
$(function() {
    var n = 1, k = 0;
    $("#button").on("click", function() {
        var left = 300 * (n^= 1)+"px";
        $('#block').animate({left : left}, 800).text(++k);
})
});
  </script>
<body>
<div id="button"></div>
<div id="block"></div>
</body>
</html>
 
		
	
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
	 
		 | 
 
 
	
	
	
		
	
		
		
		
			
			 
			
				24.04.2017, 21:38
			
			
			
		  
	 | 
 
	
		
		
		
			
			| 
			
				
				
				 Новичок на форуме 
				
				
				
				
	
 
 
 
			 | 
			  | 
			
				
				
					Регистрация: 23.04.2017 
					
					
					
						Сообщений: 8
					 
					
					
			
		
 
		 
		
			 | 
		 
		 
		
	 | 
 
	
	
	
		
		
		
		
		
	
 
	
		
			Сообщение от рони
			 
		
	 | 
 
	
		AlekSay, 
 
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8" />
    <title></title>
    <link type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  </head>
<style>
#block{ color : hsla(0, 0%, 100%, 1);
  position:absolute;
  left:300px;
  top:50px;
  width:100px;
  height:100px;
  background-color:black;
}
#button{
  position:absolute;
  top:200px;
  width:150px;
  height:100px;
  background-color:red;
}
</style>
 <script>
$(function() {
    var n = 1, k = 0;
    $("#button").on("click", function() {
        var left = 300 * (n^= 1)+"px";
        $('#block').animate({left : left}, 800).text(++k);
})
});
  </script>
<body>
<div id="button"></div>
<div id="block"></div>
</body>
</html>
	 | 
 
	
 
 На блоке счётчик кликов  
		
	
		
		
		
		
		
		
	
		
		
	
	
	 | 
 
 
	 
		 | 
 
 
 
 |  
  |