Skip to content

课后作业轮播图实现:苏州-高燕军 #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions css/fancybox.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.swiper-container {
width: 1358px;
height: 849px;
}
12 changes: 12 additions & 0 deletions css/swiper.min.css

Large diffs are not rendered by default.

Binary file added imgs/01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/03.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added imgs/04.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 32 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
<div id="marquee">
<img>
<img>
<img>
</div>
<script src="./libs/jquery.js"></script>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>幻灯片轮播</title>

<link rel="stylesheet" href="css/swiper.min.css">
<link rel="stylesheet" href="css/fancybox.css">
<link rel="stylesheet" href="css/style.css">

</head>

<body>
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide"><a data-fancybox href="./imgs/01.jpg"><img src="./imgs/01.jpg"></a></div>
<div class="swiper-slide"><a data-fancybox href="./imgs/02.jpg"><img src="./imgs/02.jpg"></a></div>
<div class="swiper-slide"><a data-fancybox href="./imgs/03.jpg"><img src="./imgs/03.jpg"></a></div>
</div>
<div class="swiper-pagination"></div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
<script src="./libs/jquery.js"></script>
<script src="./libs/swiper.min.js"></script>
<script src="./libs/jquery.fancybox.min.js"></script>
<script src="./libs/marquee.js"></script>
<script src="./js/main.js"></script>
</body>

</html>
13 changes: 13 additions & 0 deletions libs/jquery.fancybox.min.js

Large diffs are not rendered by default.

18 changes: 15 additions & 3 deletions libs/marquee.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
$.fn.marquee = function() {
// 可翻页
// popup when click
// 可以用 fancybox
// 初始化swiper
// TODO: 轮播逻辑看了一下同学写的,大概清楚,等有能力的时候再改为手写的逻辑。
new Swiper('.swiper-container', {
loop: true,
lazy: {
loadPrevNext: true,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
pagination: {
el: '.swiper-pagination',
}
});
}
13 changes: 13 additions & 0 deletions libs/swiper.min.js

Large diffs are not rendered by default.