我写了一些JQuery / Javascript,希望在菜单中创建一个幻灯片,将背景图像推到一边。菜单本身滑动很好,但由于某种原因我不能让身体移动。这是JavaScript,HTML和CSS。
var main = function(){
$('.icon').click(function()
{
$('.menu').animate({
left: "0px"
}, 200);
$('.body').animate({
left:"300px"
}, 200);
});
};
$(document).ready(main);
@charset "utf-8";
body {
background-image: url(http://wallpapercave.com/wp/U7rb02o.jpg);
background-size: cover;
left: 0px;
position: relative;
margin: 0px;
overflow: hidden;
top: 0px;
right: 0px;
bottom: 0px;
}
.menu {
background-image: url((https
://image.freepik.com/free-vector/white-cubes-pattern_1053-248.jpg))
background: url("https://image.freepik.com/free-vector/white-cubes-pattern_1053-248.jpg");
background-repeat: repeat;
background-position: left top;
background-image: url(http://wallpapers.ae/wp-content/uploads/2014/10/Black-Pattern-Background-Wallpaper.jpg);
height: 100%;
width: 300px;
position: fixed;
left: -300px;
cursor: pointer;
}
.icon {
padding-top: 25px;
padding-right: 0px;
padding-left: 25px;
padding-bottom: 25px;
width: 75px;
cursor: pointer;
height: 40px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JQuery Test</title>
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="body">
<div class="icon">
</div>
</div>
<div class="menu">
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="app.js"></script>
</body>
</html>
答案 0 :(得分:0)
这样的事情应该让你开始:
basename
&#13;
TypeError: as_view() takes 1 positional argument but 2 were given
&#13;
$(document).ready(function(){
$('.icon').click(function(){
main();
});
});
function main() {
$('.menu').animate({
left: 0
}, 200);
$('.body').animate({
left: "300px"
}, 200);
}
&#13;