lunchbox-js
var frontEnd = function(){
//Globals
var width = viewportSize.getWidth(),
height = viewportSize.getHeight(),
headerHt = $('header').outerHeight(),
body = $('body'),
_this = $(this);
var fitvideo = function(){
$('.container').fitVids();
};// fitvid
var vendorFrontCarousel = function(){
$('#vendorCarousel').carousel({
itemWidth: 260,
itemHeight: 260,
distance: 8,
//autoSlideshow: true,
selectedItemDistance: 20,
selectedItemZoomFactor: 0.9,
unselectedItemZoomFactor: 0.7,
unselectedItemAlpha: 0.6,
motionStartDistance: 210,
topMargin: 30,
gradientStartPoint: 0.35,
gradientOverlayColor: "#fbfcfe",
gradientOverlaySize: 190,
//selectByClick: true
});
$('.sc-overlay').click(function(){
$(this).css({'pointer-events':'none'});
});
};//vendorFrontCarousel
var innerEvanCarousel = function(){
$('#innerEventsCarousel').carousel({
itemWidth: 180,
itemHeight: 180,
distance: 9,
//autoSlideshow: true,
selectedItemDistance: 20,
selectedItemZoomFactor: 0.9,
unselectedItemZoomFactor: 0.7,
unselectedItemAlpha: 0.6,
motionStartDistance: 210,
topMargin: 30,
gradientStartPoint: 0.35,
gradientOverlayColor: "#fbfcfe",
gradientOverlaySize: 190,
//selectByClick: true
});
$('.sc-overlay').click(function(){
$(this).css({'pointer-events':'none'});
});
//var item = $('.events .sky-carousel .sky-carousel-container li');
//var target = $('.eventordering-page');
//var preForm = $('.event-main-form');
//item.each(function( index ){
//$(this).on('click', function(){
//target.addClass('eventordering-page-open');
// $("html, body").stop(true, true).animate({ scrollTop: "0" }, '500');
// preForm.addClass('push-bottom');
//});
//});
//$('.close-box').on('click',function(){
//target.removeClass('eventordering-page-open');
//preForm.removeClass('push-bottom');
//});
}//innerEvanCarousel();
var scrollToDivs = function(){
var desktopMenuscroll = function(){
$(document)
.on('click', 'a[href*="#"]:not(.nav-tabs a[href*="#"])', function() {
if ( this.hash && this.pathname === location.pathname ) {
$.bbq.pushState( '#/' + this.hash.slice(1) );
return false;
}
})
.ready(function() {
$(window).bind('hashchange', function(event) {
var tgt = location.hash.replace(/^#\/?/,'');
if ( document.getElementById(tgt) ) {
$.smoothScroll({scrollTarget: '#' + tgt});
}
});
$(window).trigger('hashchange');
});
};
desktopMenuscroll();
// enquire.register("screen and (min-width: 992px)", {
// match : function() {
// desktopMenuscroll();
// }
// });
};
var heights = function(){
$('.banner').css({'margin-top':headerHt});
};
var rightsidebarToggle = function(){
//Global namespace object 'rightbars'
var rightbars = rightbars || {};
rightbars = {
bannerHt : $('#bannerPart').outerHeight(),
scrollToptoHeight: function(){
$(window).scroll(function(){
var scrollHt = $('.banner').outerHeight();
if($(this).scrollTop() >= scrollHt){
//$('.right-sidebar').attr({'id':'me42'});
$('.login-btn').click(function(){
$("html, body").stop(true, true).animate({ scrollTop: "0" }, '500');
return false;
});
} else if($(this).scrollTop() === 0){
//$('.right-sidebar').attr({'id':''});
}
});
},
desktopHt : function(){
$('.right-sidebar').css({ 'height' : + this. bannerHt });
},
responsiveHt : function(){
$('.right-sidebar').css({ 'height' : height, 'position':'fixed' });
},
showLoginbtn : function(){
$('.header-login').removeClass('col-md-offset-5');
},
tooglerightBar : function(){
$('.login-btn').on('click', function(){
$('.right-sidebar').toggleClass('right-sidebar-open');
return false;
});
$('.close-btn').on('click', function(){
$('.right-sidebar').removeClass('right-sidebar-open');
return false;
});
//body.on('click',function(evt){
//if(evt.target.id === "slideLogin") return;
//if($(evt.target).closest('#slideLogin').length)
//return;
//$('.right-sidebar').removeClass('right-sidebar-open');
//});
},
responsivemenuClick : function(){
var mobmenulinks = $('.right-sidebar-wrapper').find('.mob-menu ul > li > a');
mobmenulinks.each(function(){
$(this).on('click',function(e){
e.preventDefault();
$('.right-sidebar').toggleClass('right-sidebar-open');
//return false;
});
});
},
addScrolltologinSignup : function(){
$('.login-signup-blocks').slimScroll({
height: '450px'
});
},
appendOverlayVendorCar : function(){
var toAppendDiv = $('.sky-carousel-wrapper');
$('<div class="new-overlay"></div> <div class="new-overlay-right"></div>').appendTo( toAppendDiv );
},
rightSidebarforotherPages : function(){
$('.inner-banner-part').find('.right-sidebar').css({'height':height});
}
};
//for Desktop
enquire.register("screen and (min-width: 992px)", {
match : function() {
rightbars.desktopHt();
rightbars.tooglerightBar();
rightbars.scrollToptoHeight();
rightbars.appendOverlayVendorCar();
rightbars.rightSidebarforotherPages();
}
});
// iPad Landscape view
enquire.register("screen and (min-device-width: 768px) and (max-device-width: 1024px) and (orientation:landscape)", {
match : function() {
rightbars.showLoginbtn();
rightbars.responsiveHt();
rightbars.responsivemenuClick();
rightbars.addScrolltologinSignup();
rightbars.rightSidebarforotherPages();
}
});
// For Normal Mobile
enquire.register("screen and (max-width: 800px)", {
match : function() {
rightbars.responsiveHt();
rightbars.tooglerightBar();
rightbars.responsivemenuClick();
rightbars.addScrolltologinSignup();
rightbars.rightSidebarforotherPages();
}
});
//for Google Nexus
enquire.register("screen and (min-width: 960px) and ( max-width: 961px)", {
match : function() {
rightbars.responsiveHt();
rightbars.tooglerightBar();
rightbars.responsivemenuClick();
rightbars.addScrolltologinSignup();
rightbars.rightSidebarforotherPages();
}
});
};
var bacToTop = function(){
$('#backTop').backTop({
'position' : 1600,
'speed' : 300,
'color' : 'black',
});
};//bacToTop
var tableBootstrap = function(){
$('.bootstrap-table').find('.fixed-table-toolbar').addClass('clearfix');
$('.bootstrap-table').next('.clearfix').remove();
};//tableBootstrap
return{
init: function(){
fitvideo();
//imgLiquify();
vendorFrontCarousel();
innerEvanCarousel();
scrollToDivs();
//heights();
rightsidebarToggle();
bacToTop();
tableBootstrap();
}
};
}();