-
Notifications
You must be signed in to change notification settings - Fork 0
/
instafeed-with-swiper-lazy.html
90 lines (74 loc) · 2.39 KB
/
instafeed-with-swiper-lazy.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!--SO U JUST NEED TO CHANGE INSTAGRAM USER ID AND AFTER U CAN USE THIS PLUGIN ON YOUR WEBSITE-->
<!--ITS ALREADY LAZY LOADING AND PERFORMANCE OPTIMIZATED-->
<head>
<link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">
</head>
<style>
#insta-feed .swiper-container {
width: 100%;
padding-bottom: 50px;
}
#insta-feed .swiper-slide {
background-position: center;
background-size: cover;
width: 300px;
height: 300px;
}
#insta-feed a img {
height: 300px;
width: 300px;
object-fit: cover;
}
</style>
<body>
<div class="swiper-container mySwiper">
<div class="swiper-wrapper" id="insta-feed">
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="instafeed.min.js"></script>
<script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
<script>
$(document).ready(function () {
var userFeed = new Instafeed({
get: "user",
userId: "YOUR-USER-ID",
target: id = "insta-feed",
resolution: "low_resolution",
template: '<div class="swiper-slide"><a href="{{link}}" target="_blank" id="{{id}}"><img width="1080" height="1080" class="swiper-lazy" data-src="{{image}}" /></a> <div class="swiper-lazy-preloader"> </div> </div>',
limit: 10,
sortBy: "most-recent",
accessToken: "YOUR-ACCESS-KEY",
after: function () {
new Swiper('.mySwiper', {
spaceBetween: 100,
centeredSlides: false,
slidesPerView: "auto",
autoplay: 3000,
preloadImages: 1,
loop: false,
lazy: true,
updateOnImagesReady: false,
lazyLoadingInPrevNextAmount: 1,
watchSlidesVisibility: true,
effect: "coverflow",
coverflowEffect: {
rotate: 10,
depth: 350,
slideShadows: true
},
keyboard: {
enabled: true
},
pagination: {
el: ".swiper-pagination"
}
});
}
});
setTimeout(function () { userFeed.run(); }, 3000);
});
</script>
</body>
</html>