core/skin/js/js.js

82 lines
3.7 KiB
JavaScript

$(function() {
$("a.ancLinks").click(function() {
var elementClick = $(this).attr("href");
var destination = $(elementClick).offset().top;
$('html,body').animate({ scrollTop: destination }, 3000);
return false;
});
function init() {
$.ajax({
type: "POST",
url: "/act/ajax",
data: "act=stat_mob&w=" + $(window).width() + "&h=" + $(window).height()
})
// $("#wid").text(w_sreen);
}
init();
$("button").click(function(event) {
var link = $(this).data('link');
var ajax = $(this).data('ajax');
var txt = $(this).data('txt');
var modalid = $(this).data('modal');
// if (modalid)$('#' + modalid).modal('show');
if (link) document.location.href = link;
if (ajax) {
$.ajax({
type: "POST",
url: ajax,
data: "txt=" + txt
})
}
})
$(".lazy").lazyload({ placeholder: "/img/grey.gif", effect: "fadeIn", failure_limit: 2, threshold: 10 });
$("#soc_btn a").click(function(event) {
var title = $("#soc_btn").attr('title');
var ss = $(this).data('ss');
var decription = $("#soc_btn").data('decription');
var url = $("#soc_btn").data('url');
var img = $("#soc_btn").data('img');
switch (ss) {
case 'vk.com':
window.open('//vk.com/share.php?url=http://b-install-nt.ru&title=' + title + '&description=' + decription + '&image=' + img, '_blank', 'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0');
break;
case 'ok.ru':
window.open('//ok.ru/dk?st.cmd=addShare&st._surl=' + url + '&title=' + title, '_blank', 'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0');
break;
case 'facebook.com':
window.open('//www.facebook.com/sharer/sharer.php?u=' + url, '_blank', 'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0');
break;
case 'mail.ru':
window.open('//connect.mail.ru/share?url=' + url + '&title=' + title + '&description=' + decription + '&imageurl=' + img, '_blank', 'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0');
break;
case 'google.com':
window.open('//plus.google.com/share?url=' + url, '_blank', 'scrollbars=0, resizable=1, menubar=0, left=100, top=100, width=550, height=440, toolbar=0, status=0');
break;
}
return false;
})
// $("body").append('<!-- link rel="stylesheet" href="/api/jquery/plugins/magnific-popup/1.1.0/magnific-popup.css" --><link rel="stylesheet" href="/api/jquery/plugins/shortcode/shortcodes.css"><!-- link rel="stylesheet" href="/api/fonts/montserrat/montserrat.css" --><link rel="stylesheet" href="/api/bootstrap/3.3.7/responsive.css"><!-- link rel="stylesheet" href="/api/fonts/eleganticons-fonts/eleganticons-fonts.css" -->' );
/*
$('.am-container').montage({
liquid: false,
fillLastRow: true,
margin: 4,
fixedHeight: 260
});*/
})
//Открыть модальное окно
$(".modal_show").click(function(event) {
var modal_id = $(this).data("modal");
$(modal_id).modal("show");
})
//Открыть модальное окно
$(".modal_hide").click(function(event) {
var modal_id = $(this).data("modal");
$(modal_id).modal("hide");
})