我希望點擊箭頭髮光圖像時,apDiv1被隱藏,橫幅在頁面上從右向左滑動。我應該添加哪些庫以及添加jqueryui庫說「jquery未定義」? 我是很新的jQuery,請與提供幫助,讓我知道在我的代碼的變化... 由於事先我想滑動div id =「banner」?
html{
height: 100%;
}
body {
margin:0;
padding:0;
background-color:Silver;
}
#apDiv1 {
position: absolute;
width: 800px;
z-index: 1;
padding: 0;
display:block;
color:#FFF;
left: 0px;
}
#apDiv2 {
min-width: 800px;
width: 100%;
position: absolute;
visibility: visible;
padding: 0;
}
#fontmain {
font-size:250px;
margin-left:400px;
padding: 0;
}
#fonttag {
font-size:30px;
margin-left:480px;
padding: 0;
}
#apDiv3 {
margin-top:260px;
font-size:90%;
margin-left:500px;
}
#apDiv4 {
margin-top:250px;
margin-left:1080px;
}
#banner {
margin-top:100px;
margin-left:175px;
background-color:Transparent;
display:none;
z-index:1;
position:relative;
}
#bannerbg {
width:930px;
height:380px;
margin-top:10px;
margin-right:10px;
display:block;
background-color:Teal;
z-index:-1;
position:absolute;
}
#left {
z-index:3;
margin-left:9px;
margin-top:280px;
position:absolute;
}
#right {
z-index:3;
position:absolute;
margin-top:280px;
margin-left:819px
}
#bot {
position:absolute;
top:0px;
left:0px;
}
<script>
$(document).ready(function(){
$("#apDiv4").click(function(){
$("#apDiv1").hide();
// Set the effect type
var effect = 'slide';
// Set the options for the effect type chosen
var options = { direction: 'left' };
// Set the duration (default: 400 milliseconds)
var duration = 900;
$("#banner").show("slide")
});
});
// function vb()
//{
//document.getElementById("apDiv1").style.display="none";
//document.getElementById("banner").style.display="block";
//}
</script>
<link rel="stylesheet" href="frontpage.css">
</head>
<body>
<form>
<div id="apDiv1">
<div id="apDiv2">
<div id="fontmain">xyzef</div>
<div id="fonttag">kljjhfghjkk</div>
<div id="apDiv3">Copyright © 2014 ___________.All rights reserved.</div>
</div>
<div id="apDiv4">
<img src="icons/next-arrow-glow.png" width="200" height="200">
</div>
</div>
<div id="banner"><img id="bot"src="icons/dark_slider_frame.png"/>
<img id="left" alt="previous" src="icons/left.png"/>
<img id="right" alt="next" src="icons/right.png"/>
<div id="bannerbg"></div>
</div>
</form>
</body>
</html>
必須包括jQuery的作爲一個單獨的腳本,然後才能使用它的方法。 – Blazemonger
在問這樣的問題之前,你應該總是谷歌錯誤。 谷歌:「jquery未定義」。你可能會在你的第一擊中得到一個堆棧溢出的答案。 – RGB
如果它說「'jQuery'未定義」,那麼它會非常令人驚訝,因爲您在上面的任何地方都沒有引用符號「jQuery」。 (現在,如果它說「'$'未定義」,那將是不同的......) –