I have a menu with this html code and write a this function for menu but I hover a one menu, all menu is open :( I don't know what should I do and when I hover out all image is open and not closed.
<ul id="sdt_menu" class="sdt_menu">
<li>
<a href="#">
<img src="../Static/Css/Images/2.jpg" alt="" />
<span class="sdt_active"></span>
<span class="sdt_wrap">
<span class="sdt_link">About me</span>
<span class="sdt_descr">Get to know me</span>
</span>
</a>
</li>
<li>
<a href="#">
<img src="../Static/Css/Images/1.jpg" alt="" />
<span class="sdt_active"></span>
<span class="sdt_wrap">
<span class="sdt_link">Portfolio</span>
<span class="sdt_descr">My work</span>
</span>
</a>
</li>
</ul>
$(function () {
$.fn.extend({
storemenu: function (options) {
var setting = {
height: 170,
width:170,
top: 0,
left: 0,
delay: 400,
duration: 500,
animateduration: 400,
easing: 'easeOutBack',
wrap: '.sdt_wrap',
active: '.sdt_active'
};
if (options != null) {
$.extend(setting, options);
}
var _elem = $(this);
mouseenter();
function mouseenter() {
_elem.bind('mouseenter', function () {
var elementindex = _elem.index(this);
var lastelementindex =_elem.last().index();
var scale = parseInt(_elem.css('width').replace("px", "") * (lastelementindex - elementindex));
_elem.find('img')
.stop(true)
.animate({
'width': setting.width + 'px',
'height': setting.height + 'px',
'left': setting.left + 'px'
}, setting.animateduration, setting.easing)
.andSelf()
.find(setting.wrap)
.stop(true)
.delay(setting.delay)
.animate({ 'top': '90px', 'left': elementindex * setting.width + 'px'}, setting.animateduration, setting.easing)
.andSelf()
.find(setting.active)
.stop(true)
.fadeIn(setting.duration)
.css('left', -scale);
});
}
mouseleave();
function mouseleave() {
_elem.bind('mouseleave', function () {
_elem.find(setting.active)
.stop(true)
.delay(400)
.fadeOut(50)
.andSelf()
.find('img')
.stop(true)
.animate({
'width': setting.width + 'px',
'height': setting.height + 'px',
'left': setting.left + 'px'
}, setting.animateduration)
.andSelf()
.find(setting.wrap)
.stop(true)
.animate({ 'top': setting.top + 'px', 'left': setting.left + 'px' }, setting.easing);
});
}
return this
}
});
});