左右可伸缩滑动门效果
的有关信息介绍如下:左右可伸缩滑动门效果
新建html文档。
准备好需要用到的图标。
书写hmtl代码。
style="Z-INDEX: 1; LEFT: 0px; BACKGROUND-IMAGE: url(images/bg_tb.gif); OVERFLOW: hidden; WIDTH: 566px; POSITION: relative; TOP: 0px; HEIGHT: 249px">
style="LEFT: 0px; POSITION: absolute; TOP: 0px">
style="LEFT: 376px; WIDTH: 410px; POSITION: absolute; TOP: 0px">
|
书写css代码。
BODY { FONT-SIZE: 9pt; }
A:link { COLOR: #444444; TEXT-DECORATION: none }
A:visited { COLOR: #444444; TEXT-DECORATION: none }
A:active { COLOR: #444444; TEXT-DECORATION: none }
A:hover { COLOR: #3a85c7; TEXT-DECORATION: underline }
.price { FONT-WEIGHT: normal; FONT-SIZE: 9pt; COLOR: #eb5d07; LINE-HEIGHT: 120%; FONT-FAMILY: "verdana"; TEXT-DECORATION: none }
.priceB { FONT-WEIGHT: bold; FONT-SIZE: 9pt; COLOR: #eb5d07; LINE-HEIGHT: 120%; FONT-FAMILY: "verdana"; TEXT-DECORATION: none }
.priceR { FONT-WEIGHT: bold; FONT-SIZE: 9pt; COLOR: #0f8ef0; LINE-HEIGHT: 120%; FONT-FAMILY: "verdana"; TEXT-DECORATION: none }
.pdtitle { FONT-WEIGHT: bold; FONT-SIZE: 9pt; COLOR: #ce674b; FONT-FAMILY: "verdana" }
书写并添加js代码。
var x = 'right';
$(document).ready(function(){
$("#LeftTodayBook").mouseover( function(){
if( x == 'left' )
{
x = null;
$("#RightTodayBook").animate({"left": "+=210px"}, "fast", null, function() {
x = 'right';
todayBookImg.src = "images/b_tbLeft.gif";
});
}
});
$("#RightTodayBook").mouseover(function(){
if( x == 'right' )
{
x = null;
$("#RightTodayBook").animate({"left": "-=210px"}, "fast", null, function() {
x = 'left';
todayBookImg.src = "images/b_tbRight.gif";
});
}
});
$("#todayBookImg").click( function(){
if( x == 'left' )
{
x = null;
$("#RightTodayBook").animate({"left": "+=210px"}, "fast", null, function() {
x = 'right';
todayBookImg.src = "images/b_tbLeft.gif";
});
}
});
});
代码整体结构。
查看效果。