-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfoodpicky.js
144 lines (123 loc) · 4.41 KB
/
foodpicky.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
/*!
* Foodpicky HTML template V 1.0
* A simple and easy to use HTML template designed for online food ordering.
* http://codenpixel.com
* Author : codenpixel (http://codenpixel.com/)
*/
/*
* Table of content
*************************************
* Loading animation seetings
* Adding images via data atr
* Range slider.Pricing slider
* Headroom (hide - show menu on scrool)
* Isotope
*
**/
$(document).ready(function() {
"use strict";
$(".animsition").animsition({
inClass: 'fade-in',
outClass: 'fade-out',
inDuration: 300,
outDuration: 300,
linkElement: '.animsition-link', // e.g. linkElement : 'a:not([target="_blank"]):not([href^=#])'
loading: true,
loadingParentElement: 'body', //animsition wrapper element
loadingClass: 'animsition-loading',
unSupportCss: ['animation-duration', '-webkit-animation-duration', '-o-animation-duration'], //"unSupportCss" option allows you to disable the "animsition" in case the css property in the array is not supported by your browser.
//The default setting is to disable the "animsition" in a browser that does not support "animation-duration".
overlay: false,
overlayClass: 'animsition-overlay-slide',
overlayParentElement: 'body'
});
$(".bg-image").css("background",function(){var a="url("+$(this).data("image-src")+") no-repeat center center";return a}),$(".bg-image").css("background-size","cover"),
/// Range slider
$("#ex2").slider({});
$("#ex2").on("slide", function(slideEvt) {
$("#ex2SliderVal").text(slideEvt.value);
});
// grab an element
var myElement = document.querySelector('#header');
// construct an instance of Headroom, passing the element
var headroom = new Headroom(myElement, {
// vertical offset in px before element is first unpinned
offset: 80, // scroll tolerance in px before state changes
tolerance: 40, // if you need other CSS classes, to apply these options.
classes: {
initial: "animated",
pinned: "fadeInDown",
unpinned: "fadeOutUp"
}
});
// initialise
headroom.init();
// initialise
headroom.init();
////////Packages filter
var $container = $(".restaurant-listing");
$container.isotope({
filter: "*",
animationOptions: {
duration: 750,
easing: "linear",
queue: false,
}
});
/////// Isotope
$("nav.primary ul a").click(function() {
var selector = $(this).attr("data-filter");
$container.isotope({
filter: selector,
animationOptions: {
duration: 750,
easing: "linear",
queue: false,
}
});
return false;
});
var $optionSets = $("nav.primary ul"),
$optionLinks = $optionSets.find("a");
$optionLinks.click(function() {
//alert( $optionLinks);
var $this = $(this);
// don"t proceed if already selected
if ($this.hasClass("selected")) {
return false;
}
var $optionSet = $this.parents("nav.primary ul");
$optionSet.find(".selected").removeClass("selected");
$this.addClass("selected");
});
//// Range slider seetings
$("#slider-range").slider({
range: true,
min: 0,
max: 500,
values: [75, 300],
slide: function(event, ui) {
//$( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
$(".minvalue").html("$" + ui.values[0]);
$(".maxvalue").html("$" + ui.values[1]);
}
});
$("#amount").val("$" + $("#slider-range").slider("values", 0) + " - $" + $("#slider-range").slider("values", 1));
////// Increment and decrement select box
$(".up").on("click", function() {
var thisObj = $(this);
var thisInput = thisObj.parent().find("input");
var prevVal = parseInt(thisInput.val());
var newVal = prevVal + 1;
thisInput.val(newVal);
});
$(".down").on("click", function() {
var thisObj = $(this);
var thisInput = thisObj.parent().find("input");
var prevVal = parseInt(thisInput.val());
var newVal = prevVal - 1;
if (newVal >= 0) {
thisInput.val(newVal);
}
});
});