2017-02-15 04:34:06 +00:00
|
|
|
(function($){
|
2017-05-18 05:13:00 +00:00
|
|
|
"use strict"; // Start of use strict
|
|
|
|
|
|
|
|
|
|
|
|
/* ---------------------------------------------
|
|
|
|
Scripts initialization
|
|
|
|
--------------------------------------------- */
|
2017-05-23 17:06:48 +00:00
|
|
|
var cardPricing ={
|
|
|
|
'cpu': {
|
|
|
|
'id': 'coreValue',
|
|
|
|
'value': 1,
|
2017-05-23 23:32:06 +00:00
|
|
|
'min':1,
|
|
|
|
'max': 48,
|
|
|
|
'interval': 1
|
2017-05-23 17:06:48 +00:00
|
|
|
},
|
|
|
|
'ram': {
|
|
|
|
'id': 'ramValue',
|
|
|
|
'value': 1,
|
2017-05-23 23:32:06 +00:00
|
|
|
'min':1,
|
|
|
|
'max': 200,
|
|
|
|
'interval': 1
|
2017-05-23 17:06:48 +00:00
|
|
|
},
|
|
|
|
'storage': {
|
|
|
|
'id': 'storageValue',
|
2017-05-23 23:32:06 +00:00
|
|
|
'value': 10,
|
|
|
|
'min': 10,
|
|
|
|
'max': 500,
|
|
|
|
'interval': 10
|
2017-05-23 17:06:48 +00:00
|
|
|
}
|
|
|
|
}
|
2017-05-18 05:13:00 +00:00
|
|
|
$(window).load(function(){
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2017-02-15 04:34:06 +00:00
|
|
|
$(document).ready(function(){
|
2017-02-17 14:13:32 +00:00
|
|
|
verifiedUrl();
|
2017-05-18 05:13:00 +00:00
|
|
|
_navScroll();
|
|
|
|
_initScroll();
|
|
|
|
_initNavUrl();
|
2017-05-23 17:06:48 +00:00
|
|
|
_initPricing();
|
2017-05-18 05:13:00 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$(window).resize(function(){
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-02-15 04:34:06 +00:00
|
|
|
});
|
2017-05-18 05:13:00 +00:00
|
|
|
|
2017-02-15 04:34:06 +00:00
|
|
|
|
2017-02-17 14:13:32 +00:00
|
|
|
|
2017-05-18 05:13:00 +00:00
|
|
|
/* ---------------------------------------------
|
|
|
|
Nav panel classic
|
|
|
|
--------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
function _initScroll(){
|
|
|
|
$(window).scroll(function(){
|
|
|
|
_navScroll();
|
2017-02-17 14:13:32 +00:00
|
|
|
});
|
2017-02-15 04:34:06 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-05-18 05:13:00 +00:00
|
|
|
function _navScroll(){
|
|
|
|
if($(window).scrollTop() > 10 ){
|
|
|
|
$(".navbar").removeClass("navbar-transparent");
|
|
|
|
$(".navbar-default .btn-link").css("color", "#777");
|
|
|
|
}else{
|
|
|
|
$(".navbar").addClass("navbar-transparent");
|
|
|
|
$(".navbar-default .btn-link").css("color", "#fff");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function _initNavUrl(){
|
|
|
|
$('.url').click(function(){
|
|
|
|
var href = $(this).attr('data-url');
|
|
|
|
console.log(href);
|
|
|
|
$('html, body').animate({
|
|
|
|
scrollTop: $(href).offset().top
|
|
|
|
}, 1000);
|
2017-02-17 14:13:32 +00:00
|
|
|
});
|
2017-02-15 04:34:06 +00:00
|
|
|
}
|
2017-05-18 05:13:00 +00:00
|
|
|
function verifiedUrl(){
|
|
|
|
if(window.location.href.indexOf('#success') > -1){
|
|
|
|
form_success();
|
|
|
|
console.log('epa');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-23 17:06:48 +00:00
|
|
|
function _initPricing(){
|
|
|
|
_fetchPricing();
|
|
|
|
|
|
|
|
$('.fa-minus-circle.left').click(function(event){
|
|
|
|
var data = $(this).data('minus');
|
|
|
|
|
2017-05-23 23:32:06 +00:00
|
|
|
if(cardPricing[data].value > cardPricing[data].min){
|
2017-05-23 17:06:48 +00:00
|
|
|
cardPricing[data].value --;
|
|
|
|
}
|
|
|
|
_fetchPricing();
|
|
|
|
});
|
|
|
|
$('.fa-plus-circle.right').click(function(event){
|
|
|
|
var data = $(this).data('plus');
|
2017-05-23 23:32:06 +00:00
|
|
|
if(cardPricing[data].value < cardPricing[data].max){
|
|
|
|
cardPricing[data].value = cardPricing[data].value + cardPricing[data].interval;
|
2017-05-23 17:06:48 +00:00
|
|
|
}
|
|
|
|
_fetchPricing();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function _fetchPricing(){
|
|
|
|
Object.keys(cardPricing).map(function(element){
|
|
|
|
$('#'+cardPricing[element].id).text(cardPricing[element].value);
|
|
|
|
$('input[name='+element+']').val(cardPricing[element].value);
|
|
|
|
});
|
|
|
|
_calcPricing();
|
|
|
|
}
|
|
|
|
|
|
|
|
function _calcPricing(){
|
|
|
|
var total = (cardPricing['cpu'].value * 5) + (2* cardPricing['ram'].value) + (0.6* cardPricing['storage'].value)
|
2017-05-23 23:32:06 +00:00
|
|
|
total = parseFloat(total.toFixed(2));
|
2017-05-23 17:06:48 +00:00
|
|
|
|
|
|
|
$("#total").text(total);
|
|
|
|
$('input[name=total]').val(total);
|
|
|
|
}
|
2017-02-17 14:13:32 +00:00
|
|
|
function form_success(){
|
|
|
|
$('#sucessModal').modal('show');
|
|
|
|
}
|
2017-02-15 04:34:06 +00:00
|
|
|
function _calculate(numbers, price){
|
2017-02-17 14:13:32 +00:00
|
|
|
$('#valueTotal').text(numbers*price*31);
|
|
|
|
}
|
2017-02-15 04:34:06 +00:00
|
|
|
|
2017-05-18 05:13:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
})(jQuery);
|
|
|
|
// (function($){
|
|
|
|
// 'use strict'; // Start of use strict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $(document).ready(function(){
|
|
|
|
// verifiedUrl();
|
|
|
|
// init_options_interested();
|
|
|
|
// init_nav();
|
|
|
|
// change_values();
|
|
|
|
// });
|
|
|
|
|
|
|
|
// function verifiedUrl(){
|
|
|
|
// if(window.location.href.indexOf('#success') > -1){
|
|
|
|
// form_success();
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// function init_options_interested(){
|
|
|
|
// $('.row-vms').click(function(){
|
|
|
|
// $('.row-vms').removeClass('row-vms__active');
|
|
|
|
// $(this).addClass('row-vms__active');
|
|
|
|
// var number = $('.row-vms__active input').val();
|
|
|
|
// var price = $('.row-vms__active input').data('price');
|
|
|
|
// _calculate(number, price);
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
|
|
|
|
// function init_nav(){
|
|
|
|
|
|
|
|
// $('.nav-local').click(function(){
|
|
|
|
// $('html, body').animate({
|
|
|
|
// scrollTop: $('#'+$(this).data('href')).offset().top
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// function change_values(){
|
|
|
|
// $('.number-vms').keyup(function () {
|
|
|
|
// var number = $(this).val();
|
|
|
|
// var price = $(this).data('price');
|
|
|
|
// _calculate(number, price);
|
|
|
|
// });
|
|
|
|
|
|
|
|
// }
|
|
|
|
// function form_success(){
|
|
|
|
// $('#sucessModal').modal('show');
|
|
|
|
// }
|
|
|
|
// function _calculate(numbers, price){
|
|
|
|
// $('#valueTotal').text(numbers*price*31);
|
|
|
|
// }
|
|
|
|
|
2017-02-15 04:34:06 +00:00
|
|
|
|
2017-05-18 05:13:00 +00:00
|
|
|
// })(jQuery); // End of use strict
|
|
|
|
|