I've got a set of product categories. Each category has some products images . I've created a parent div which has an overflow:hidden CSS value. I want to achieve an mouse hover effect. As soon as you hover over the categories I want to show the related category product images. i tried much but still not get perfect solution Here's a small snippet: here is my Fiddle Demo
<div class="menu" id="1" style="width:200px;">
<a href="#">category 1</a>
</div>
<div class="flyout hidden" id="12">
<div class="list">
<ul>
<li><span class="box">1</span></li>
<li><span class="box">2</span></li>
<li><span class="box">3</span></li>
<li><span class="box">4</span></li>
<li><span class="box">5</span></li>
<li><span class="box">6</span></li>
<li><span class="box">7</span></li>
<li><span class="box">8</span></li>
<li><span class="box">9</span></li>
</ul>
</div>
<button class="prev">prev</button>
<button class="more">more</button>
</div><br><br>
<div class="menu" id="2" style="width:200px;">
<a href="#">category 2</a>
</div>
<div class="flyout hidden" id="11" >
<div class="list">
<ul>
<li><span class="box">11</span></li>
<li><span class="box">12</span></li>
<li><span class="box">13</span></li>
<li><span class="box">14</span></li>
<li><span class="box">15</span></li>
<li><span class="box">16</span></li>
<li><span class="box">17</span></li>
<li><span class="box">18</span></li>
<li><span class="box">19</span></li>
</ul>
</div>
<button class="prev">prev</button>
<button class="more">more</button>
</div>
//Script
$(".more").click(function(){
$(".list").animate({scrollLeft: "+=330"}, 300, "swing");
});
$(".prev").click(function(){
$(".list").animate({scrollLeft: "-=330"}, 300, "swing");
});
$(".menu").hover(function(){
var gal_id =$(this).next().attr('id');
//alert(gal_id);
var id='#'+gal_id;
$(id).removeClass('hidden');
},function(){
$(id).addClass('hidden');
});
//Css
body {
margin: 5px;
}
.list {
overflow: hidden;
height:110px;
width: 353px;
margin-left: -38px;
}
ul {
overflow: hidden;
width:2000px;
}
li {
float: left;
}
.box {
width: 100px;
height: 100px;
background: #33cccc;
margin: 5px;
display: block;
}
.flyout{
position:absolute;
width:320px;
height:250px;
margin-left:20px;
background:red;
overflow: hidden;
z-index:10000;
}
.hidden{
visibility: hidden;
}