-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
37 lines (31 loc) · 1.07 KB
/
script.js
File metadata and controls
37 lines (31 loc) · 1.07 KB
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
// scroll to top starts
var scrolltop = $('#scroll-top');
$(window).scroll(function() {
if ($(window).scrollTop() > 80) {
scrolltop.addClass('active');
} else {
scrolltop.removeClass('active');
}
});
scrolltop.on('click', function(e) {
e.preventDefault();
$('html, body').animate({scrollTop:0}, '200');
});
// scroll to top ends
fetch('style_links.json')
.then(response => response.json())
.then(data => {
let links = data;
for (let i = 0; i < links.length; i++) {
console.log(links.length);
let StyleBoxDiv = document.createElement('div');
StyleBoxDiv.innerHTML = `<div class="stylebox">
<div class="image">
<img src="https://raw.githubusercontent.com/arpit456jain/Cool-Front-End_Templates/master/${links[i].name}/preview.png" alt="">
</div>
<p>${links[i].name}</p>
<a target="_blank" href="${links[i].link}">View</a>
</div>`;
document.getElementById('styles').appendChild(StyleBoxDiv);
};
});