v2.5.2
Giriş yap

Hover Efekti ile Genişleyen Buton

Anonim
471 defa görüntülendi ve 2 kişi tarafından değerlendirildi

Alttaki alıntı fotoğraftaki gibi yuvarlak butonlarım var ama bende resimdeki gibi buton hover olunca genişlemesini ve soluna yazı yazdırmak istiyorum. İlla css ile olcak diye bir şey yok jquery ile de olur. Nasıl yapabilirim?

Resim:
https://imgur.com/a/OGq2nyM

recep
1359 gün önce

aslında olay position ile konumlandırıp :hover olunca göstermekten ibaret. Şöyle bir html yapın olsun;

<nav class="sticky-menu">
	<ul>
		<li>
			<a href="#">
				<span class="title">Homepage</span>
				<span class="icon">
					<i class="fa fa-home"></i>
				</span>
			</a>
		</li>
		<li>
			<a href="#">
				<span class="title">About us</span>
				<span class="icon">
					<i class="fa fa-user"></i>
				</span>
			</a>
		</li>
		<li>
			<a href="#">
				<span class="title">Youtube</span>
				<span class="icon">
					<i class="fab fa-youtube"></i>
				</span>
			</a>
		</li>
		<li>
			<a href="#">
				<span class="title">Contact</span>
				<span class="icon">
					<i class="fa fa-envelope-open"></i>
				</span>
			</a>
		</li>
	</ul>
</nav>
HTML

css'inde şöyle olacak

/* genel sıfırlama */
* {
  padding: 0;
  margin: 0;
  list-style: none;
  border: none;
  box-sizing: border-box;
  text-decoration: none;
  font-family: Arial, sans-serif;
}

.sticky-menu {
  position: fixed;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}
.sticky-menu ul li {
  margin-bottom: 10px;
}
.sticky-menu ul li:last-child {
  margin-bottom: 0;
}
.sticky-menu ul li a {
  position: relative;
  display: block;
}
.sticky-menu ul li a .title {
  height: 40px;
  padding: 0 65px 0 25px;
  position: absolute;
  top: 0;
  right: 0;
  background: darkorange;
  display: flex;
  align-items: center;
  border-radius: 20px;
  opacity: 0;
  visibility: hidden;
  transition: 150ms all ease;
  font-size: 14px;
  color: #fff;
  white-space: nowrap;
}
.sticky-menu ul li a .icon {
  display: flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: #eee;
  border-radius: 50%;
  position: relative;
  z-index: 1;
  color: darkorange;
  transition: 150ms all ease;
}
.sticky-menu ul li a:hover .icon {
  background: darkorange;
  color: #fff;
}
.sticky-menu ul li a:hover .title {
  opacity: 1;
  visibility: visible;
}
CSS

çalışan demo: https://codepen.io/recephp/pen/abWpWro