Показать сообщение отдельно
  #16 (permalink)  
Старый 10.04.2013, 19:35
Аспирант
Отправить личное сообщение для Ervin Посмотреть профиль Найти все сообщения от Ervin
 
Регистрация: 19.03.2013
Сообщений: 84

Сорри было лень сделать раньше. Вот то что я щас написал. Если добавить css стилей, вроде загнутого угла и тд. может получится что-то. Работает в
хроме.

function animate() {
	var el = document.getElementById("shape"),
		animation = {},
		model = (typeof el.style.webkitTransform !== "undefined") ? "webkitTransform" : (typeof el.style.MozTransform !== "undefined") ? "MozTransform" : "msTransform";
	
	el.removeEventListener("click", animate, false);
	
	animation = setInterval(function() {
		var transform = el.style[model],
			degree = +transform.replace(/[a-z\(\),\s-0]/g, ""),
			width = +el.style.width.replace("px", ""),
			left = +el.style.left.replace("px", "");
		
		if(width > 10) {
			el.style.width = (width - 10) + "px";
			el.style.left = (left + 10) + "px";
			el.style[model] = "skew(0deg," + (degree + 0.2) + "deg)";
		}
		else {
			clearInterval(animation);
			
			el.children[0].textContent = ["It's a beautiful life, oh oh ooh It's a beautiful life, oh oh ooh",
						"It's a beautiful life, oh oh ooh I just wanna be here beside you You can do what you want just seize the day",
						"What you're doing tomorrow's gonna come your way Don't you ever consider givin' up, you will find, ooh",
						"It's a beautiful life, oh oh ooh It's a beautiful life, oh oh ooh It's a beautiful life, oh oh ooh",
						"I just wanna be here beside you It's a beautiful life, oh oh ooh",
						"It's a beautiful life, oh oh ooh It's a beautiful life, oh oh ooh I just wanna be here beside you",
						"Beautiful, beautiful, beautiful Take a walk in the park when you feel down There's so many things there",
						"that's gonna lift you up See the nature in bloom a laughing child Such a dream, ooh"].join();
			
			animation = setInterval(function() {
				var transform = el.style[model],
					degree = +transform.replace(/[a-z\(\),\s-0]/g, ""),
					width = +el.style.width.replace("px", "");
				
				if(width < 250) {
					el.style.width = (width + 10) + "px";
					
					if(degree > 0.2) {
						degree = degree - 0.2;
						
						el.style[model] = "skew(0deg, -" + degree + "deg)";
					}
				}
				else {
					clearInterval(animation);
				}
			}, 10);
		}
	}, 10);
}

function bindAnimation() {
	var el = document.getElementById("shape");
	
	el.addEventListener("click", animate, false);
}

window.onload = bindAnimation;

#shape {
	margin: 50px;
	width: 250px;
	min-height: 300px;
	padding:5px;
	position:relative;
	background:#fff;
	background: -webkit-gradient(linear, 0% 20%, 0% 92%, from(#fff), to(#f3f3f3), color-stop(.1,#fff));
	background: -moz-linear-gradient(0% 0% 270deg, #fff, #fff 10%, #f3f3f3);
	border-top: 1px solid #ccc;
	border-right: 1px solid #ccc;
	border-left: 1px solid #ccc;
	-webkit-border-top-left-radius: 60px 5px;
	-moz-border-radius-topleft:60px 5px;
	border-top-left-radius:60px 5px;
	-webkit-border-top-right-radius: 60px 5px;
	-moz-border-radius-topright:60px 5px;
	border-top-right-radius:60px 5px;
	-webkit-box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.3) ;
	-moz-box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.3) ;
	box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.3) ;
	overflow:hidden;
}

.text {
	width:250px;
	height:300px;
}

<div id="shape" style="width:250px;"><div class="text">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div></div>


Я рекомендую использовать flip плагин.

Могу помочь разобраться почему не работает, если будет source code в котором ошибка.
Ответить с цитированием