// Page scroll
$(function() {
$('a.page-scroll').bind('click', function(event) {
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1500, 'easeInOutExpo');
event.preventDefault();
});
});
// Highlight the top nav as scrolling occurs
$('body').scrollspy({
target: '.navbar-fixed-top'
})
// Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a').click(function() {
$('.navbar-toggle:visible').click();
});
//Toggle selected
$('.box').click(function() {
$(this).toggleClass('selected');
});
// Small Logo Upon Scroll
(function($) {
$(window).scroll(function() {
if($(this).scrollTop() > 0) {
$('.logo').stop().animate({ width: 'auto', height: '150%' }, 100, 'linear');
}
else {
$('.logo').stop().animate({ width: 'auto', height: '228%' }, 200, 'linear');
}
});
})(jQuery);
//statistics
(function ($) {
$.fn.countTo = function (options) {
options = options || {};
return $(this).each(function () {
// set options for current element
var settings = $.extend({}, $.fn.countTo.defaults, {
from: $(this).data('from'),
to: $(this).data('to'),
speed: $(this).data('speed'),
refreshInterval: $(this).data('refresh-interval'),
decimals: $(this).data('decimals')
}, options);
// how many times to update the value, and how much to increment the value on each update
var loops = Math.ceil(settings.speed / settings.refreshInterval),
increment = (settings.to - settings.from) / loops;
// references & variables that will change with each update
var self = this,
$self = $(this),
loopCount = 0,
value = settings.from,
data = $self.data('countTo') || {};
$self.data('countTo', data);
// if an existing interval can be found, clear it first
if (data.interval) {
clearInterval(data.interval);
}
data.interval = setInterval(updateTimer, settings.refreshInterval);
// initialize the element with the starting value
render(value);
function updateTimer() {
value += increment;
loopCount++;
render(value);
if (typeof(settings.onUpdate) == 'function') {
settings.onUpdate.call(self, value);
}
if (loopCount >= loops) {
// remove the interval
$self.removeData('countTo');
clearInterval(data.interval);
value = settings.to;
if (typeof(settings.onComplete) == 'function') {
settings.onComplete.call(self, value);
}
}
}
function render(value) {
var formattedValue = settings.formatter.call(self, value, settings);
$self.html(formattedValue);
}
});
};
$.fn.countTo.defaults = {
from: 0, // the number the element should start at
to: 0, // the number the element should end at
speed: 1000, // how long it should take to count between the target numbers
refreshInterval: 100, // how often the element should be updated
decimals: 0, // the number of decimal places to show
formatter: formatter, // handler for formatting the value before rendering
onUpdate: null, // callback method for every time the element is updated
onComplete: null // callback method for when the element finishes updating
};
function formatter(value, settings) {
return value.toFixed(settings.decimals);
}
}(jQuery));
jQuery(function ($) {
// custom formatting example
$('#count-number').data('countToOptions', {
formatter: function (value, options) {
return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ',');
}
});
// start all the timers
$('.stats-number').each(count);
function count(options) {
var $this = $(this);
options = $.extend({}, options || {}, $this.data('countToOptions') || {});
$this.countTo(options);
}
});
//GOOGLE MAP
$(function () {
function initMap() {
var location = new google.maps.LatLng(42.6620567, 23.318018800000004);
var mapCanvas = document.getElementById('map');
var mapOptions = {
center: location,
zoom: 16,
panControl: false,
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU,
position:google.maps.ControlPosition.BOTTOM_RIGHT,
mapTypeIds: [
google.maps.MapTypeId.ROADMAP,
google.maps.MapTypeId.TERRAIN
]
},
mapTypeId: google.maps.MapTypeId.ROADMAP,
style:[
{"featureType":"landscape.man_made",
"elementType":"geometry",
"stylers":[{"color":"#f7f1df"}]},
{"featureType":"landscape.natural",
"elementType":"geometry",
"stylers":[{"color":"#d0e3b4"}]},
{"featureType":"landscape.natural.terrain",
"elementType":"geometry",
"stylers":[{"visibility":"off"}]},
{"featureType":"poi",
"elementType":"labels",
"stylers":[{"visibility":"off"}]},
{"featureType":"poi.business",
"elementType":"all",
"stylers":[{"visibility":"off"}]},
{"featureType":"poi.medical",
"elementType":"geometry",
"stylers":[{"color":"#fbd3da"}]},
{"featureType":"poi.park",
"elementType":"geometry",
"stylers":[{"color":"#bde6ab"}]},
{"featureType":"road",
"elementType":"geometry.stroke",
"stylers":[{"visibility":"off"}]},
{"featureType":"road",
"elementType":"labels",
"stylers":[{"visibility":"off"}]},
{"featureType":"road.highway",
"elementType":"geometry.fill",
"stylers":[{"color":"#ffe15f"}]},
{"featureType":"road.highway",
"elementType":"geometry.stroke",
"stylers":[{"color":"#efd151"}]},
{"featureType":"road.arterial",
"elementType":"geometry.fill",
"stylers":[{"color":"#ffffff"}]},
{"featureType":"road.local",
"elementType":"geometry.fill",
"stylers":[{"color":"black"}]},
{"featureType":"transit.station.airport",
"elementType":"geometry.fill",
"stylers":[{"color":"#cfb2db"}]},
{"featureType":"water",
"elementType":"geometry",
"stylers":[{"color":"#a2daf2"}]}
]
}
var map = new google.maps.Map(mapCanvas, mapOptions);
var markerImage = 'images/marker.png';
var marker = new google.maps.Marker({
position: location,
map: map,
icon: markerImage,
title:'Promise Dev.'
});
var contentString = '';
if (contentString == '')
contentString ='Promise Dev.
бул.”Черни връх” 47A, 1407 София, България
';
var infowindow = new google.maps.InfoWindow({
content: contentString,
maxWidth: 400,
borderColor: '#37a000'
});
marker.addListener('click', function () {
infowindow.open(map, marker);
});infowindow.open(map, marker);
}
google.maps.event.addDomListener(window, 'load', initMap);
});
//scroll footer
function scrollFooter(scrollY, heightFooter)
{
if(scrollY >= heightFooter)
{
$('footer').css({
'bottom' : '0px'
});
}
else
{
$('footer').css({
'bottom' : '-' + heightFooter + 'px'
});
}
}
$(window).load(function(){
var windowHeight = $(window).height(),
footerHeight = $('footer').height(),
heightDocument = (windowHeight) + ($('.content').height()) + ($('footer').height()) - 20;
// Definindo o tamanho do elemento pra animar
$('#scroll-animate, #scroll-animate-main').css({
'height' : heightDocument + 'px'
});
// Definindo o tamanho dos elementos header e conteúdo
$('header').css({
'height' : windowHeight + 'px',
'line-height' : windowHeight + 'px'
});
$('.wrapper-parallax').css({
'margin-top' : windowHeight + 'px'
});
scrollFooter(window.scrollY, footerHeight);
// ao dar rolagem
window.onscroll = function(){
var scroll = window.scrollY;
$('#scroll-animate-main').css({
'top' : '-' + scroll + 'px'
});
$('header').css({
'background-position-y' : 50 - (scroll * 100 / heightDocument) + '%'
});
scrollFooter(scroll, footerHeight);
}
});