我使用mootools创建了两个滑块,
基本上它是两个<div>
,我一个接一个地滑动它,但问题是我无法设置位置,它是一个低于另一个,我想要的是两者都应该进入一行,并且slider2应该从slider1结束点开始
我的代码如下,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
h3.section {
margin-top: 1em;
}
#test{
background: #D0C8C8;
color: #8A7575;
padding: 10px;
border: 5px solid #F3F1F1;
font-weight: bold;
width:66px;
height:66px;
float:left;
}
#testing{
background: #D88888;
color: #8A7575;
padding: 10px;
border: 5px solid #F3F1F1;
font-weight: bold;
width:66px;
height:66px;
float:left;
}
</style>
<script type="text/javascript" src="mootools-core-1.4-full.js"> </script>
<script type="text/javascript" src="mootools-more-1.4-full.js"> </script>
<script type="text/javascript">
window.addEvent('domready', function() {
var one = new Fx.Slide('test', {mode: 'horizontal'});
var two = new Fx.Slide('testing', {mode: 'horizontal'});
one.hide();
two.hide();
one.slideIn();
one.addEvent('complete', function() {
two.slideIn();
});
});
</script>
</head>
<body>
<div id="test">
</div>
<div id="testing">
</div>
</body>
</html>
任何人都可以帮助我,
答案 0 :(得分:1)
问题是由Fx.Slide处理的每个div都将被div元素包装。因此,要实现您想要的功能,您可以使用css进行一些操作,例如添加一个匹配测试/测试包装器div的规则
#container > div{
float:left;
}
/* note that I wrapped the 2 divs test and testing inside #container div */