亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

請問這個是怎么回事,沒有出現頁面切換

<%@ 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>My JSP 'index.jsp' starting page</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">

-->

<title>慕課七夕主題</title>

? ? <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

? ? <style type="text/css">

? ? /*初始化所有元素*/

? ? *{

? ? padding:0;

? ? margin:0;

? ? }

? ? /*去點*/

? ? ul,li{

? ? list-style-type:none;

? ? }

? ? /*主體部分*/

? ? #content{

? ? width:60%;

? ? height:60%;

? ? /*top:20%;

? ? left:20%;*/

? ? overflow:hidden;

? ? position:absolute;/*絕對定位*/

? ? border:1px solid #ccc;/*設置邊框寬度,樣式(實線、虛線、點線),顏色*/

? ? }

? ? .content-wrap{

? ? position:relative;/*相對定位*/

? ? }

? ? .content-wrap>li{

? ? width:100%;

? ? height:100%;

? ? background:#CAE1FF;

? ? color:red;

? ? float:right;

? ? overflow:hidden;

? ? position:relative;/*相對定位*/

? ? }

? ? /*CSS3:選取li的第二個標簽*/

? ? li:nth-child(2){

? ? background: #9BCD9B;

? ? }

? ? /*CSS3:選取li的第三個標簽*/

? ? li:nth-child(3){

? ? background: yellow;

? ? }

? ? button{

? ? width:100px;

? ? height:50px;

? ? }

? ? .button{

? ? position:absolute;

? ? bottom:0;

? ? }

? ? </style>

? ??

? </head>

??

? <body>

? ? <div id="content">

? ? <ul class="content-wrap">

? ? <li>頁面一</li>

? ? <li>頁面二</li>

? ? <li>頁面三</li>

? ? </ul>

? ? <div class="button">

? ? <button>點擊切換頁面</button>

? ? </div>

? ? </div>

? ? <script type="text/javascript">

? ? var container = $("#content");//div

? ? ? ? // 獲取第一個子節點

? ? ? ? var element = container.find(":first");//ul

? ? ? ? // li頁面數量

? ? ? ? var slides = element.find("li");//li

? ? ? ? // 獲取容器尺寸

? ? ? ? var width = container.width();

? ? ? ? var height = container.height();

? ? ? ? // 設置li頁面總寬度

? ? ? ? element.css({

? ? ? ? width:(slides.length*width)+'px',

? ? ? ? height:height+'px'

? ? ? ? });

? ? ? ? // 設置每一個頁面li的寬度

? ? ? ? $.each(slides,function(index){

? ? ? ? var slides=slides.eq(index);//獲取第幾個slides

? ? ? ? slides.css({

? ? ? ? width:width+'px',

? ? ? ? height:height+'px'

? ? ? ? });

? ? ? ? });

? ? ? ? // 綁定一個事件,觸發通過

? ? ? ? $('button').click(function() {

? ? ? ? ? ? // 在5秒的時間內,移動X的位置,為2個頁面單位

? ? ? ? ? ? element.css({

? ? ? ? ? ? ? ? 'transition-timing-function': 'linear',

? ? ? ? ? ? ? ? 'transition-duration': '5000ms',

? ? ? ? ? ? ? ? 'transform': 'translate3d(-' + (width * 2) + 'px,0px,0px)' //設置頁面X軸移動

? ? ? ? ? ? });

? ? ? ? });

? ? </script>

? </body>

</html>


正在回答

1 回答

http://img1.sycdn.imooc.com//5d75d70100019e0705630270.jpg

運行你的代碼的時候,提示錯誤并沒有定義eq屬性,到代碼里查找錯誤發現你定義了兩個相似的變量,也不是說兩個相似變量吧,就是用的時候發生沖突了。

http://img1.sycdn.imooc.com//5d75d9eb0001411e06520332.jpg

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

請問這個是怎么回事,沒有出現頁面切換

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號