-
Notifications
You must be signed in to change notification settings - Fork 0
/
google-gallery.js
157 lines (139 loc) · 5.83 KB
/
google-gallery.js
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
$(function () {
gallerfy();
var curPicPos = 0;
//Pictures details view
$(".picflex .resultitem > .box > a").click(function (e) {
console.log('opn');
$(this).parent().parent().find('.addToOrder').children().attr('title', $(this).parent().find('.cart-add').attr('title'));
$(".picflex .resultitem").removeClass("open");
$(this).parent().parent().addClass("open");
curPicPos = $(this).parent().attr('data-pos');
$(window).scrollTop(curPicPos);
e.preventDefault();
});
$(".picflex .resultitem").find(".detailNext").click(function () {
$(this).parent().parent().find('.addToOrder').children().attr('title', $(this).parent().find('.cart-add').attr('title'));
$(this).parent().parent().parent().parent().next().addClass("open").prev().removeClass("open");
curPicPos = $(this).parent().parent().parent().parent().next().find('.box').attr('data-pos');
$(window).scrollTop(curPicPos);
return false;
});
$(".picflex .resultitem").find(".detailPrev").click(function () {
$(this).parent().parent().find('.addToOrder').children().attr('title', $(this).parent().find('.cart-add').attr('title'));
$(this).parent().parent().parent().parent().prev().addClass("open").next().removeClass("open");
curPicPos = $(this).parent().parent().parent().parent().prev().find('.box').attr('data-pos');
$(window).scrollTop(curPicPos);
return false;
});
$(".picflex .resultitem").find(".detailClose").click(function () {
$(".picflex .resultitem").removeClass("open");
return false;
});
$(".open #orderClick").click(function () {
var picId = $(this).parent().parent().parent().parent().parent().find('.iconlinks').children().eq(0).attr('id')
$("#" + picId).trigger('click');
});
//Pictures details view
//gallry to list to gallery view
$('.toggleView > span').click(function () {
$('.toggleView span').removeClass('active');
var view = $(this).data('view');
$(this).addClass('active');
if (view != "picflex") {
$('.viewchange').removeClass('picflex listview').addClass(view).find('.resultitem').removeAttr('style').find('.thumbMeta').toggleClass('col-sm-6 col-sm-12');
} else {
$('.viewchange').removeClass('picflex listview').addClass(view).find('.thumbMeta').toggleClass('col-sm-6 col-sm-12');
gallerfy();
}
});
//Mouse over popup
$(".viewchange .resultitem .box").on("mouseenter", function () {
var imgpop = $(this).parent().find('.thumbnail_popup'),
poppos = imgpop.offset(),
imgover = $(this).offset(),
screnWidth = $(window).width() / 2,
screnHeight = ($(window).height() - 320) / 2,
imgoverHeight = $(this).outerHeight();
if (imgover.left < screnWidth) {
imgpop.addClass('popposLeft');
//imgpop.css({ 'left': 110 });
} else if (imgover.left > screnWidth) {
imgpop.addClass('popposRight');
// imgpop.css({ 'left': -435 });
}
if (imgover.top < screnHeight) {
imgpop.removeClass('popposBottom').addClass('popposTop');
//imgpop.css({ 'top': 0 });
} else if (imgover.top > screnHeight) {
imgpop.removeClass('popposTop').addClass('popposBottom');
//imgpop.css({ 'bottom': 0 });
}
imgpop.show();
}).on("mouseleave", function () {
$('.thumbnail_popup').hide();
});
/*scroll to top start*/
$(window).scroll(function () {
if ($(this).scrollTop() > 150) {
$('a[href="#top"]').show();
} else {
$('a[href="#top"]').hide();
}
});
// scroll body to 0px on click
$('a[href="#top"]').click(function () {
$(window).animate({
scrollTop: 0
}, 800);
return false;
});
/*scroll to top ends*/
/*Date Picker from to */
$.getScript('//cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.7.1/js/bootstrap-datepicker.js', function () {
var date = new Date();
var today = new Date(date.getFullYear(), date.getMonth(), date.getDate());
var daysback = new Date(date.getFullYear(), date.getMonth(), date.getDate() - 30);
$('#date-from').datepicker({
autoclose: true,
format: 'dd MM yyyy'
}).datepicker('setDate', daysback);
$('#date-to').datepicker({
autoclose: true,
endDate: new Date(),
format: 'dd MM yyyy'
}).datepicker('setDate', today);
$('.icon-arrow-left').addClass('glyphicon glyphicon-chevron-left');
$('.icon-arrow-right').addClass('glyphicon glyphicon-chevron-right');
});
});
//$.getScript('//cdn.rawgit.com/xremix/xGallerify/master/dist/jquery.xgallerify.min.js', function () {
function gallerfy() {
$('.picflex .box').each(function () {
var boxWidth = $(this).attr('data-imgWidth'),
boxHeight = $(this).attr('data-imgHeight');
(boxWidth > boxHeight) ? $(this).parent().attr('style', "width:" + parseInt(boxWidth * 200 / boxHeight) + "px"): $(this).parent().attr('style', "width:" + parseInt(180 / boxHeight * boxWidth) + "px");
$(this).attr('data-pos', parseInt($(this).offset().top) - 65);
});
//var gallery = $('.picflex').gallerify({
// mode: {
// maxHeight: screen.height * 0.5,
// breakPoints: [
// {
// minWidth: 1170,
// columns: 5,
// }, {
// minWidth: 970,
// columns: 4,
// }, {
// minWidth: 750,
// columns: 3,
// }, {
// maxWidth: 750,
// columns: 2,
// }
// ]
// },
// lastRow: 'adjust'
//});
}
//});