使用jquery cxscroll 实现图片轮播效果

JQuery 新民 2477℃ 已收录 1评论

index.jsp

         <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>使用jquery.cxscroll插件实现图片轮播效果</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
     <script type="text/javascript" src="js/jquery.min.js?v201509091705" ></script>
     <script type="text/javascript" src="cxscroll/js/jquery.cxScroll.js?v201509091705"></script>
     <link rel="stylesheet" type="text/css" href="cxscroll/css/jquery.cxscroll.css?v201509091705" >
  </head>
  
  <body>
		 <div id="element_id" class="cxscroll"> 
  			<div class="box"> 
    			<ul class="list"> 
      				<li><a href="http://www.baidu.com"><img src="cxscroll/images/zsgd1.jpg?v201509091705"></a></li> 
      				<li><a href="http://www.w3cschool.com"><img src="cxscroll/images/zsgd2.jpg?v201509091705"></a></li> 
      				<li><a href="http://www.snowruin.com"><img src="cxscroll/images/zsgd3.jpg?v201509091705"></a></li> 
      				<li><a href="http://www.runoob.com/"><img src="cxscroll/images/zsgd4.jpg?v201509091705"></a></li> 
      				<li><a href="http://www.58.com"><img src="cxscroll/images/zsgd5.jpg?v201509091705"></a></li> 
    			</ul> 
  			</div>
		    <div class="prev"></div> 
		    <div class="next"></div> 
		</div>


  </body>
  <script type="text/javascript">
  $(document).ready(function(){
  		$('#element_id').cxScroll();
  });
  </script>
</html>

 

jquery.cxscroll.css

@charset "utf-8";
/* 横向滚动基本样式 */
.cxscroll{
width:747px;
margin:0 auto;
margin-top:20px;
position:relative;
background-color: #eee;
border-radius:5px;
}

.cxscroll .box{
overflow:hidden;
width:600px;
margin:0 auto;
}

.cxscroll .list{
overflow:hidden;
width:9999px;
margin-left: -6px;
}

.cxscroll .list li{
float:left;
width:200px;
height:255px;
}

.cxscroll .prev{
background:url(../images/L.png?v201509091705) no-repeat center;
width:30px;
height:96px;
position:absolute;
left:21px;
top:100px;
cursor:pointer;
}

.cxscroll .next{
background:url(../images/R.png?v201509091705) no-repeat center;
width:30px;
height:96px;
position:absolute;
right:22px;
top:100px;
cursor:pointer;
}

 

效果:

QQ截图20150918092058

本站文章如未注明,均为原创丨本网站采用BY-NC-SA协议进行授权,转载请注明转自:https://www.snowruin.com/?p=1499
喜欢 (5)or分享 (0)
发表我的评论
取消评论
表情 代码 贴图 加粗 链接 私信 删除线 签到

Hi,请填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(1)条精彩评论。
  1. 韩美女车模2015-10-06 14:16 回复| unknow| unknow