Skip to content

Instantly share code, notes, and snippets.

@sreehari
Created February 28, 2015 13:34
Show Gist options
  • Save sreehari/6c89783cad905ea593ca to your computer and use it in GitHub Desktop.
Save sreehari/6c89783cad905ea593ca to your computer and use it in GitHub Desktop.
// Custom Script
// Developed by: Samson.Onna
// CopyRights : http://webthemez.com
var customScripts = {
profile: function () {
var portfolio = $('#portfolio');
var items = $('.items', portfolio);
var filters = $('.filters li a', portfolio);
items.imagesLoaded(function() {
items.isotope({
itemSelector: '.item',
layoutMode: 'fitRows',
transitionDuration: '0.7s'
});
});
filters.click(function(){
var el = $(this);
filters.removeClass('active');
el.addClass('active');
var selector = el.attr('data-filter');
items.isotope({ filter: selector });
return false;
});
},
fancybox: function () {
// fancybox
$(".fancybox").fancybox();
},
onePageNav: function () {
$('#mainNav').onePageNav({
currentClass: 'active',
changeHash: false,
scrollSpeed: 950,
scrollThreshold: 0.2,
filter: '',
easing: 'swing',
begin: function () {
//I get fired when the animation is starting
},
end: function () {
//I get fired when the animation is ending
if(!$('#main-nav ul li:first-child').hasClass('active')){
$('.header').addClass('addBg');
}else{
$('.header').removeClass('addBg');
}
},
scrollChange: function ($currentListItem) {
//I get fired when you enter a section and I pass the list item of the section
if(!$('#main-nav ul li:first-child').hasClass('active')){
$('.header').addClass('addBg');
}else{
$('.header').removeClass('addBg');
}
}
});
$("a[href='#top']").click(function () {
$("html, body").animate({ scrollTop: 0 }, "slow");
return false;
});
$("a[href='#basics']").click(function () {
$("html, body").animate({ scrollTop: $('#services').offset().top - 75 }, "slow");
return false;
});
},
owlSlider: function () {
var owl = $("#owl-demo");
owl.owlCarousel();
// Custom Navigation Events
$(".next").click(function () {
owl.trigger('owl.next');
})
$(".prev").click(function () {
owl.trigger('owl.prev');
})
},
bannerHeight: function () {
var bHeight = $(".banner-container").height();
$('#da-slider').height(bHeight);
$(window).resize(function () {
var bHeight = $(".banner-container").height();
$('#da-slider').height(bHeight);
});
},
waySlide: function(){
/* Waypoints Animations
------------------------------------------------------ */
},
fitText: function(){
setTimeout(function() {
$('h1.responsive-headline').fitText(1.2, { minFontSize: '16px', maxFontSize: '30px' });
}, 100);
},
init: function () {
customScripts.onePageNav();
customScripts.profile();
customScripts.fancybox();
customScripts.owlSlider();
customScripts.waySlide();
customScripts.fitText();
customScripts.bannerHeight();
}
}
$('document').ready(function () {
customScripts.init();
$('.carousel').carousel();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment