css3 - jquery to change image and show captions on mouse-hover -



css3 - jquery to change image and show captions on mouse-hover -

below codes: class="snippet-code-css lang-css prettyprint-override"> * { font-family: arial; } .slide-container { /*border: solid 1px;*/ width: 500px; height: 360px; } .slide-jumbo { /*border: solid 1px;*/ width: 500px; height: 300px; overflow: hidden; } .jumbo { position: relative; display: inline-block; width: 500px; height: 300px; float: left; } .jumbo img, .thumb img { position: absolute; left: 0; } .jumbo img { top: 0; } .thumb img { bottom: 0; } .jumbo-capt, .thumb-capt { width: 100%; background-color: rgba(0,0,0,0.8); position: absolute; color: #fff; z-index: 100; /* -webkit-transition: 300ms ease-out; -moz-transition: 300ms ease-out; -o-transition: 300ms ease-out; -ms-transition: 300ms ease-out; transition: 300ms ease-out; */ left: 0; bottom: 0; } .slide-thumb { /*border: solid 1px;*/ width: 500px; height: 60px; overflow: hidden; } .thumb { position: relative; /*border: solid 1px;*/ display: inline-block; width: 100px; height: 60px; overflow: hidden; float: left; } class="snippet-code-html lang-html prettyprint-override"><!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" > <title></title> <script src="js/jquery.min.js"></script> <style type="text/css"> * { font-family: arial; } .slide-container { /*border: solid 1px;*/ width: 500px; height: 360px; } .slide-jumbo { /*border: solid 1px;*/ width: 500px; height: 300px; overflow: hidden; } .jumbo { position: relative; display: inline-block; width: 500px; height: 300px; float: left; } .jumbo img, .thumb img { position: absolute; left: 0; } .jumbo img { top: 0; } .thumb img { bottom: 0; } .jumbo-capt, .thumb-capt { width: 100%; background-color: rgba(0,0,0,0.8); position: absolute; color: #fff; z-index: 100; /* -webkit-transition: 300ms ease-out; -moz-transition: 300ms ease-out; -o-transition: 300ms ease-out; -ms-transition: 300ms ease-out; transition: 300ms ease-out; */ left: 0; bottom: 0; } .slide-thumb { /*border: solid 1px;*/ width: 500px; height: 60px; overflow: hidden; } .thumb { position: relative; /*border: solid 1px;*/ display: inline-block; width: 100px; height: 60px; overflow: hidden; float: left; } </style> </head> <body> <div class="slide-container"> <div class="slide-jumbo"> <div class="jumbo" data-image="1"> <img src="images/2.png"> <div class="jumbo-capt"> <h3>title 1</h3> <p>summary 1</p> </div> </div> <div class="jumbo" data-image="2"> <img src="images/3.png"> <div class="jumbo-capt"> <h3>title 2</h3> <p>summary 2</p> </div> </div> <div class="jumbo" data-image="3"> <img src="images/9.png"> <div class="jumbo-capt"> <h3>title 3</h3> <p>summary 3</p> </div> </div> <div class="jumbo" data-image="4"> <img src="images/7.png"> <div class="jumbo-capt"> <h3>title 4</h3> <p>summary 4</p> </div> </div> <div class="jumbo" data-image="5"> <img src="images/9.png"> <div class="jumbo-capt"> <h3>title 5</h3> <p>summary 5</p> </div> </div> </div> <div class="slide-thumb"> <div class="thumb" data-image="1"> <img src="images/2small.png"> <div class="thumb-capt"> <p> <strong> title 1 </strong> </p> </div> </div> <div class="thumb" data-image="2"> <img src="images/3small.png"> <div class="thumb-capt"> <p> <strong> title 2 </strong> </p> </div> </div> <div class="thumb" data-image="3"> <img src="images/9small.png"> <div class="thumb-capt"> <p> <strong> title 3 </strong> </p> </div> </div> <div class="thumb" data-image="4"> <img src="images/7small.png"> <div class="thumb-capt"> <p> <strong> title 4 </strong> </p> </div> </div> <div class="thumb" data-image="5"> <img src="images/9small.png"> <div class="thumb-capt"> <p> <strong> title 5 </strong> </p> </div> </div> </div> </div> </body> </html>

how can add together js changing image , show caption on mouse-hover?

try : can utilize mouseenter event , utilize fadein / fadeout show / hide images.

$(function(){ $('.slide-thumb .thumb').on("mouseenter",function(){ var dataimage = $(this).data('image'); $('.slide-jumbo .jumbo:visible').fadeout(1000,function(){ $('.slide-jumbo .jumbo[data-image="'+dataimage+'"]').fadein(500); }); }); });

demo

jquery css3 slider mousehover

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -