整体思路:
1.实现页面布局,设置css样式
2.用jQuery获取需要用到的变量
3.用jQuery为两个按钮绑定事件
一.页面布局:
<div class="d1"> //随便在网上找一张图片放入img中// <img src="https://dummyimage.com/900x400/0000ff/ff" alt="" class="c1 c2"> <div class="d2"> <input type="button" value="<-" id="b1"> <input type="button" value="->" id="b2"> </div> </div>
<style> body{ margin: 0 0 0 0; height: 1000px; width: 100%; } .d1{ position: absolute; width: 100%; height: 500px; top: 50%; margin-top: -250px; } .d2{ margin-left: 950px; } .d1 img{ margin-left: 50px; position: relative; } .c1{ display: block; padding-left: 500px; } </style>
我的css布局仅仅做了居中ÿ