|
|
@@ -1,9 +1,70 @@
|
|
1
|
|
-$(function() {
|
|
2
|
|
- setInterval(function() {
|
|
3
|
|
- $('.pointmark.old').remove();
|
|
4
|
|
- $('.pointmark.current').css('left', '-100%').addClass('old');
|
|
5
|
|
- $('.pointmark.next').css('left', '0').removeClass('next').addClass('current');
|
|
6
|
|
- $('<div>', {class: 'pointmark next'}).css('left', '100%').css('background', 'url(http://lorempixel.com/g/1920/1080/?='+ Math.random() + ') fixed center no-repeat').appendTo($('body'));
|
|
7
|
|
- }, 5000);
|
|
8
|
|
- console.log('ready');
|
|
|
1
|
+//$(function() {
|
|
|
2
|
+document.addEventListener("DOMContentLoaded", function() {
|
|
|
3
|
+
|
|
|
4
|
+ function changeBg() {
|
|
|
5
|
+ var url = 'http://lorempixel.com/1920/1080/?='+ Math.random();
|
|
|
6
|
+ //$('.pointmark.old').remove();
|
|
|
7
|
+ var old = document.querySelector('.pointmark.old');
|
|
|
8
|
+ if (old)
|
|
|
9
|
+ old.parentNode.removeChild(old);
|
|
|
10
|
+
|
|
|
11
|
+ //$('.pointmark.current').css('left', '-100%').removeClass('current').addClass('old');
|
|
|
12
|
+ var current = document.querySelector('.pointmark.current');
|
|
|
13
|
+ current.style.left = '-100%';
|
|
|
14
|
+ current.classList.remove('current');
|
|
|
15
|
+ current.classList.add('old');
|
|
|
16
|
+
|
|
|
17
|
+ //$('.pointmark.next').css('left', '0').removeClass('next').addClass('current');
|
|
|
18
|
+ var next = document.querySelector('.pointmark.next');
|
|
|
19
|
+ next.style.left = '0';
|
|
|
20
|
+ next.classList.remove('next');
|
|
|
21
|
+ next.classList.add('current');
|
|
|
22
|
+
|
|
|
23
|
+ var next = document.createElement('div');
|
|
|
24
|
+ next.classList.add('pointmark');
|
|
|
25
|
+ next.classList.add('next');
|
|
|
26
|
+ next.style.left = '100%';
|
|
|
27
|
+ next.style.background = 'url(' + url +') fixed center no-repeat';
|
|
|
28
|
+ document.getElementById('pointmark').appendChild(next);
|
|
|
29
|
+ //$('<div>', { class: 'pointmark next' }).css('left', '100%').css('background', 'url(' + url +') fixed center no-repeat').appendTo($('#pointmark'));
|
|
|
30
|
+ }
|
|
|
31
|
+
|
|
|
32
|
+ function slideStart() { return setInterval(changeBg, 5000); };
|
|
|
33
|
+
|
|
|
34
|
+ var slide;
|
|
|
35
|
+
|
|
|
36
|
+ //$('.pointmark-trigger').on('click', function() {\
|
|
|
37
|
+ document.getElementsByClassName("pointmark-trigger")[0].addEventListener('click', function(e) {
|
|
|
38
|
+ if (slide) {
|
|
|
39
|
+ clearInterval(slide);
|
|
|
40
|
+ slide = null;
|
|
|
41
|
+ e.target.classList.remove('fa-pause');
|
|
|
42
|
+ e.target.classList.add('fa-play');
|
|
|
43
|
+ //$(this).find('i').removeClass('fa-pause').addClass('fa-play');
|
|
|
44
|
+ } else {
|
|
|
45
|
+ changeBg();
|
|
|
46
|
+ slide = slideStart();
|
|
|
47
|
+ e.target.classList.remove('fa-play');
|
|
|
48
|
+ e.target.classList.add('fa-pause');
|
|
|
49
|
+ //$(this).find('i').removeClass('fa-play').addClass('fa-pause');
|
|
|
50
|
+ }
|
|
|
51
|
+ });
|
|
|
52
|
+});
|
|
|
53
|
+
|
|
|
54
|
+$(document).ready(function(){
|
|
|
55
|
+ //Check to see if the window is top if not then display button
|
|
|
56
|
+ $(window).scroll(function(){
|
|
|
57
|
+ if ($(this).scrollTop() > 100) {
|
|
|
58
|
+ $('.scrollToTop').fadeIn();
|
|
|
59
|
+ } else {
|
|
|
60
|
+ $('.scrollToTop').fadeOut();
|
|
|
61
|
+ }
|
|
|
62
|
+ });
|
|
|
63
|
+
|
|
|
64
|
+ //Click event to scroll to top
|
|
|
65
|
+ $('.scrollToTop').click(function(){
|
|
|
66
|
+ $('html, body').animate({scrollTop : 0},800);
|
|
|
67
|
+ return false;
|
|
|
68
|
+ });
|
|
|
69
|
+
|
|
9
|
70
|
});
|