4箱あります。それらの 1 つにカーソルを合わせると、他の 3 つが非表示になり、ホバーされた 1 つが展開されます。ただし、コールバックが起動されていないため、拡張部分は発生していません!
コード: (フィドルはこちら: http://jsfiddle.net/CpKLk/5/ )
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function ()
{
$("div#Content div").hover(function ()
{
var toShow = $(this);
toShow.siblings().hide("swing", null, "slow", function ()
{
//Never gets here!
toShow.addClass("Expanded");
alert("Changing class!");
});
}, function ()
{
var toShow = $(this);
toShow.siblings().show("swing", null, "slow", function ()
{
//Never gets here!
toShow.removeClass("Expanded");
alert("Changing class!");
});
});
});
</script>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<style type="text/css">
div#Content
{
white-space: nowrap;
}
div#Content div
{
width: 100px;
height: 100px;
display: inline-block;
}
div#Content div#Box1
{
background-color: red;
}
div#Content div#Box2
{
background-color: blue;
}
div#Content div#Box3
{
background-color: green;
}
div#Content div#Box4
{
background-color: pink;
}
div#Content div.Expanded
{
width: 100%;
}
</style>
</head>
<body>
<div id="Content">
<div id="Box1"></div>
<div id="Box2"></div>
<div id="Box3"></div>
<div id="Box4"></div>
</div>
</body>
</html>