/*
* Create HTML5 elements for IE's sake
*/
/* catch ie10 */
if (/*@cc_on!@*/false) {
document.documentElement.className+=' ie10';
}
/* slider */
jQuery(window).load(function() {
jQuery('ul.sf-menu').superfish();
});
/* scroll to top */
jQuery(document).ready(function(){
// hide #back-top first
jQuery("#back-top").hide();
// fade in #back-top
jQuery(function () {
jQuery(window).scroll(function () {
if (jQuery(this).scrollTop() > 500) {
jQuery('#back-top').fadeIn();
} else {
jQuery('#back-top').fadeOut();
}
});
// scroll body to 0px on click
jQuery('#back-top a').click(function () {
jQuery('body,html').animate({
scrollTop: 0
}, 800);
return false;
});
});
});
//owl
$(document).ready(function() {
$("#owl-demo").owlCarousel({
navigation : true,
autoPlay: true,
slideSpeed : 300,
paginationSpeed : 400,
pagination:false,
singleItem : true,
transitionStyle : "fade",
beforeMove: function(){
$(".flex-caption").css("display","none");
// BEFORE going to the next slide (hide captions)
},
afterMove: function(){
$(".flex-caption").delay(100).fadeIn(500);
// AFTER going to next slide (show captions)
}
// "singleItem:true" is a shortcut for:
// items : 1,
// itemsDesktop : false,
// itemsDesktopSmall : false,
// itemsTablet: false,
// itemsMobile : false
});
});
//scroll
$(function () {
$('a[href*=#]:not([href=#])').click(function () {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: (target.offset().top - 5)
}, 850);
return false;
}
}
});
});
//Validation
// When the browser is ready...
$(function() {
// Setup form validation on the #register-form element
$("#register-form").validate({
// Specify the validation rules
rules: {
firstname: "required",
message: "required",
email: {
required: true,
email: true
},
password: {
required: true,
minlength: 5
},
agree: "required"
},
// Specify the validation error messages
messages: {
firstname: "Please enter your first name",
message: "Please enter your message",
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
},
email: "Please enter a valid email address",
agree: "Please accept our policy"
},
submitHandler: function(form) {
form.submit();
}
});
});
//menu
$(document).ready(function() {
$('#nav').onePageNav();
});
//menu toggle
$("#menu-close").click(function(e) {
e.preventDefault();
$("#sidebar-wrapper").toggleClass("active");
});
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#sidebar-wrapper").toggleClass("active");
});