垂直和水平滑动

时间:2013-07-16 15:07:24

标签: jquery slide

我正在寻找可以垂直和水平滚动的滑块。我希望在其他区域滑动箭头。这有可能,如果是这样的话怎么样? 我有一张照片:

http://msdev.de/1.png

1 个答案:

答案 0 :(得分:0)

试试这个:

WORKING FIDDLE

<button id="left">&#9668;</button>
<button id="bottom">&#9660;</button>
<button id="right">&#9658;</button>
<div class="block"></div>



div {
  position:absolute;
  background-color:#000;
  left:50px;
  width:90px;
  height:90px;
  margin:5px;
  top:50px;
}


var slideDistance;
var slideSpeed;

//Change this Properties
slideDistance = 200;
slideSpeed = 500;


$("#right").click(function(){
  $(".block").animate({"left": "+=" + slideDistance + "px"}, slideSpeed);
});

$("#left").click(function(){
  $(".block").animate({"left": "-=" + slideDistance + "px"}, slideSpeed);
});

$("#bottom").click(function(){
  $(".block").animate({"top": "+=" + slideDistance + "px"}, slideSpeed);
});