LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code
CSS
body {
  font-family: 'Open Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
  background: #513B56;
}

.menu {
  width: 300px;
  height: 500px;
  padding: 10px 0;
  background: #525174;
  /* Old browsers */
  /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
  margin: 100px auto 100px;
  position: relative;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  text-align: center;
  border-radius: 8px;
}
.menu span {
  color: #fff;
  font-size: 1.2rem;
  font-weight: 900;
  text-transform: uppercase;
}
.menu strong {
  padding: 10px 0;
}
.menu-wrapper {
  position: absolute;
  left: 50%;
  top: 27%;
}
.menu-toggle-button, .menu-item-bounce, .menu-item-button {
  background-color: #5DD39E;
  box-shadow: 0 8px 25px 6px rgba(0, 0, 0, 0.2);
  border-radius: 50%;
  width: 80px;
  height: 80px;
  margin-left: -40px;
  margin-top: -40px;
  height: 80px;
  color: #fff;
  border: none;
  outline: none;
  position: relative;
}
.menu-toggle-button {
  background: transparent;
  position: absolute;
  top: 0;
  left: 0;
}
.menu-toggle-icon {
  font-size: 30px;
  position: absolute;
  top: 0;
  left: 0;
  width: 80px;
  height: 80px;
  line-height: 80px;
}
.menu-items {
  list-style-type: none;
  padding: 0;
  margin: 0;
  position: absolute;
  left: 0;
  top: 0;
}
.menu-item {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
}
.menu-item-bounce {
  position: absolute;
  top: 0;
  left: 0;
}
.menu-item-button {
  width: 60px;
  height: 60px;
  margin-left: -30px;
  margin-top: -30px;
  position: absolute;
  top: 0;
  left: 0;
  color: #AD4C4C;
}
.menu-item-button .fa {
  font-size: 1.5rem;
  color: #fff;
}
.menu-item-button .fa-inbox {
  transform: rotate(182deg);
}
.menu-item-button .fa-twitter {
  transform: rotate(180deg);
}
.menu-item-button .fa-google-plus {
  transform: rotate(120deg);
}

.facebook-button {
  background-color: #3B5999;
}

.twiter-button {
  background-color: #00A0D1;
}

.google-plus-button {
  background-color: #E02828;
}

.email {
  position: absolute;
  top: 50%;
}
.email input {
  position: relative;
  width: 90%;
  margin: 10px auto;
  height: 30px;
  background: none;
  border: none;
  border-bottom: 1px solid #ddd;
  outline: none;
  color: #fff;
  font-size: .9rem;
  letter-spacing: 0.01rem;
}
.email span {
  color: #fff;
  font-size: .9rem;
  font-weight: 900;
  text-transform: lowercase;
}
JS
$(document).ready(function(){
	var menuItemNum=$(".menu-item").length;
	var angle=120;
	var distance=90;
	var startingAngle=180+(-angle/2);
	var slice=angle/(menuItemNum-1);
	TweenMax.globalTimeScale(0.8);
	$(".menu-item").each(function(i){
		var angle=startingAngle+(slice*i);
		$(this).css({
			transform:"rotate("+(angle)+"deg)"
		})
		$(this).find(".menu-item-icon").css({
			transform:"rotate("+(-angle)+"deg)"
		})
	})
	var on=false;

	$(".menu-toggle-button").mousedown(function(){
		TweenMax.to($(".menu-toggle-icon"),0.1,{
			scale:0.65
		})
	})
	$(document).mouseup(function(){
		TweenMax.to($(".menu-toggle-icon"),0.1,{
			scale:1
		})
	});
	$(document).on("touchend",function(){
		$(document).trigger("mouseup")
	})
	$(".menu-toggle-button").on("mousedown",pressHandler);
	$(".menu-toggle-button").on("touchstart",function(event){
		$(this).trigger("mousedown");
		event.preventDefault();
		event.stopPropagation();
	});

	function pressHandler(event){
		on=!on;

		TweenMax.to($(this).children('.menu-toggle-icon'),0.4,{
			rotation:on?45:0,
			ease:Quint.easeInOut,
			force3D:true
		});

		on?openMenu():closeMenu();
		
	}
	function openMenu(){
		$(".menu-item").each(function(i){
			var delay=i*0.08;

			var $bounce=$(this).children(".menu-item-bounce");

			TweenMax.fromTo($bounce,0.2,{
				transformOrigin:"50% 50%"
			},{
				delay:delay,
				scaleX:0.8,
				scaleY:1.2,
				force3D:true,
				ease:Quad.easeInOut,
				onComplete:function(){
					TweenMax.to($bounce,0.15,{
						// scaleX:1.2,
						scaleY:0.7,
						force3D:true,
						ease:Quad.easeInOut,
						onComplete:function(){
							TweenMax.to($bounce,3,{
								// scaleX:1,
								scaleY:0.8,
								force3D:true,
								ease:Elastic.easeOut,
								easeParams:[1.1,0.12]
							})
						}
					})
				}
			});

			TweenMax.to($(this).children(".menu-item-button"),0.5,{
				delay:delay,
				y:distance,
				force3D:true,
				ease:Quint.easeInOut
			});
		})
	}
	function closeMenu(){
		$(".menu-item").each(function(i){
			var delay=i*0.08;

			var $bounce=$(this).children(".menu-item-bounce");

			TweenMax.fromTo($bounce,0.2,{
				transformOrigin:"50% 50%"
			},{
				delay:delay,
				scaleX:1,
				scaleY:0.8,
				force3D:true,
				ease:Quad.easeInOut,
				onComplete:function(){
					TweenMax.to($bounce,0.15,{
						// scaleX:1.2,
						scaleY:1.2,
						force3D:true,
						ease:Quad.easeInOut,
						onComplete:function(){
							TweenMax.to($bounce,3,{
								// scaleX:1,
								scaleY:1,
								force3D:true,
								ease:Elastic.easeOut,
								easeParams:[1.1,0.12]
							})
						}
					})
				}
			});
			

			TweenMax.to($(this).children(".menu-item-button"),0.3,{
				delay:delay,
				y:0,
				force3D:true,
				ease:Quint.easeIn
			});
		})
	}
})
Host Instantly Drag and Drop Website Builder

 

Term
Wed, 11/29/2017 - 11:26

Related Codes

Pen ID
Pen ID
Pen ID