Loading...

Single Post

HOME > post > Web > マウスオーバーで画像拡大のエフェクト

マウスオーバーで画像拡大のエフェクト

| Web
ウェブ制作イメージ

画像ホーバーした時に画像はズームさせ下のキャプション文字は「にゅ〜」っとアップスクロールさせるエフェクトを作成しましたので掲載いたします。また、画像全体にリンクをかけているので、ユーザービリティー向上にも一役かえそうです。

HTML


<div class="container">
	 <figure class="snip">
        <img src="images/example.jpg" alt="イメージ画像" />
           <figcaption>
               <h2>タイトルを記入</h2>
                   <p>画像やリンクページの説明文章を記載しする事ができます!!この文章はダミーです!!</p>
          </figcaption>
                   <a href="https://www.google.co.jp/"></a>
     </figure>
    </div>

CSS

画像の拡大には「transform(41行目)」を使用して拡大をさせています。キャプションのアップアニメーションも含まれていますので少し長いように感じます。キャプション部が必要ない場合は、画像に関するCSSのみを使用ください。


.container{
	width: 370px;
	margin: 0 auto;
}
         
figure.snip {
	font-family: "メイリオ", Meiryo, Osaka, "MS Pゴシック", "MS PGothic", sans-serif;
	color: #fff;
	position: relative;
	overflow: hidden;
	margin: 10px 1%;
	min-width: 100%;
	max-width: 100%;
	max-height: 100%;
	width: 100%;
	color: #fff;
	background-image: -webkit-linear-gradient(top, #ffffff 0%, #ffffff 70%);
	background-image: linear-gradient(to bottom, #ffffff 0%, ffffff 70%);
}

figure.snip * {
        -webkit-transition: all 0.35s ease;
	transition: all 0.35s ease;
}

figure.snip img {
	max-width: 100%;
	-webkit-transition: all .3s ease-out;
	-moz-transition: all .3s ease-out;
	-ms-transition: all .3s ease-out;
	 transition: all .3s ease-out;
}

figure.snip:hover img,
figure.snip.hover img {
	opacity: 0.8;
	-moz-transform: scale(1.2);
	-webkit-transform: scale(1.2);
	-ms-transform: scale(1.2);
	transform: scale(1.2);
}
figure.snip figcaption {
	position: absolute;
	bottom: 0%;
	left: 0;
	width: 100%;
	z-index: 1;
	-webkit-transform: translateY(100%);
	transform: translateY(100%);
}

figure.snip h2 {
	margin: 0;
	width: 100%;
       padding: 10px 20px 10px 20px;
}

figure.snip p {
	margin: 0;
	width: 100%;
	padding: 5px 20px 10px 20px;
}

figure.snip h2 {
	color: #0A79E8;
	position: absolute;
	bottom: 100%;
	display: block;
        font-weight: 100;
	text-transform: uppercase;
	font-size: 16px;
	background: rgba(255, 255, 255, 0.5);
}

figure.snip p {
	background: rgba(255, 255, 255, 0.5);
	text-align: left;
	bottom: 0;
	font-size: 13px;
	font-weight: 100;
	color: #555;
}

figure.snip a {
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	position: absolute;
	z-index: 1;
}



figure.snip:hover figcaption,
figure.snip.hover figcaption {
	-webkit-transform: translateY(0);
	transform: translateY(0);
}

まとめ

キャプション部のタイトルにアイコンフォントなどで矢印など入れておくと、クリック率の向上にも繋がると思います。本来ならば、リンク先のページ説明文などは通常表示しておく方が良いと思いますが、タイトル以外を隠しておくことでカラムなどで横並び表示した際に統一感が出せます。

過去の記事で「ホバー時にbackground画像をズームさせるcss3アニメーション」を記載しています。一緒に閲覧頂けると嬉しいです。

関連記事

Contact Page