Mam taki kod który po najechaniu na li zwiększa szerokość a później powraca do poprzedniego rozmiaru.
Jak dodać do tego aby po na jechaniu na ten li reszta będzie się zmniejszać wraz z tym jak on się zwiększa, a jak się zjedzie z niego myszko to aby tamte też powróciły do swojego poprzedniego rozmiaru
Kod JS:
$(function() {
$('#accordion > li').hover(
function () {
var $this = $(this);
$this.stop().animate({'width':'370px'},500);
$('.heading',$this).stop(true,true).fadeOut();
$('.bgDescription',$this).stop(true,true).slideDown(500);
$('.description',$this).stop(true,true).fadeIn();
},
function () {
var $this = $(this);
$this.stop().animate({'width':'190px'},1000);
$('.heading',$this).stop(true,true).fadeIn();
$('.description',$this).stop(true,true).fadeOut(500);
$('.bgDescription',$this).stop(true,true).slideUp(700);
}
);
});
Kod HTML
<ul class="accordion" id="accordion"> <div class="heading">Heading
</div> <div class="bgDescription"></div> <div class="description"> <p>Some descriptive text
</p> <div class="heading">Heading
</div> <div class="bgDescription"></div> <div class="description"> <p>Some descriptive text
</p> <div class="heading">Heading
</div> <div class="bgDescription"></div> <div class="description"> <p>Some descriptive text
</p> <div class="heading">Heading
</div> <div class="bgDescription"></div> <div class="description"> <p>Some descriptive text
</p> <div class="heading">Heading
</div> <div class="bgDescription"></div> <div class="description"> <p>Some descriptive text
</p>
Prawie mi się udało
<script type="text/javascript"> $(function() {
$('#accordion > li').hover(
function () {
$('#accordion > li:not(hover)').animate({'width':'170px'},500);
var $this = $(this);
$this.stop().animate({'width':'270px'},500);
$('.heading',$this).stop(true,true).fadeOut();
$('.bgDescription',$this).stop(true,true).slideDown(500);
$('.description',$this).stop(true,true).fadeIn();
},
function () {
var $this = $(this);
$this.stop().animate({'width':'190px'},500);
$('#accordion > li:not(hover)').animate({'width':'190px'},500);
$('.heading',$this).stop(true,true).fadeIn();
$('.description',$this).stop(true,true).fadeOut(500);
$('.bgDescription',$this).stop(true,true).slideUp(700);
}
);
});
tylko ze jakos dziwnie to dziala