grunt-polymer-wp
Version:
A new Grunt pipeline for Wordpress themes in HTML/js/css and Polymer webcomponents developing
166 lines (125 loc) • 6.25 kB
JavaScript
// JavaScript Document
$(document).ready(function () {
if($(window).width()>640){
$("#owl-slider-home-1, #owl-slider-home-2").owlCarousel({
nav : true,
itemElement: 'article',
dots: false,
loop: true,
navSpeed : 300,
items : 3,
margin: 20,
navText: ['<svg class="nc-icon outline" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"> <polyline fill="none" stroke="#cccccc" stroke-width="2" stroke-linecap="square" stroke-miterlimit="10" points="23,30 9,16 23,2 " transform="translate(0, 0)" stroke-linejoin="miter"></polyline> </svg>','<svg class="nc-icon outline" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"> <polyline fill="none" stroke="#cccccc" stroke-width="2" stroke-linecap="square" stroke-miterlimit="10" points="9,2 23,16 9,30 " transform="translate(0, 0)" stroke-linejoin="miter"></polyline> </svg>']
});
$(".owl-slider-square .owl-carousel").owlCarousel({
nav : true,
itemElement: 'article',
dots: true,
loop: true,
navSpeed : 300,
items : 1,
navText: ['<svg class="nc-icon outline" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"> <polyline fill="none" stroke="#000000" stroke-width="2" stroke-linecap="square" stroke-miterlimit="10" points="23,30 9,16 23,2 " transform="translate(0, 0)" stroke-linejoin="miter"></polyline> </svg>','<svg class="nc-icon outline" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="32px" height="32px" viewBox="0 0 32 32"> <polyline fill="none" stroke="#000000" stroke-width="2" stroke-linecap="square" stroke-miterlimit="10" points="9,2 23,16 9,30 " transform="translate(0, 0)" stroke-linejoin="miter"></polyline> </svg>']
});
}else{
$("#owl-slider-home-1, #owl-slider-home-2, .owl-slider-square .owl-carousel").owlCarousel({
nav : false,
dots: true,
loop: true,
navSpeed : 300,
items : 1
});
}
///////// cerca ///////////////////
$('.menu-search').find('li').click(function(){
$('#modal-search').toggleClass('is-active');
$('.menu-main, .menu-top-secondary').toggleClass('is-hidden');
$(this).find('svg.is-search').toggleClass('is-closing');
$(this).find('svg.is-close').toggleClass('is-opening');
})
// if (from_social()) {
// setTimeout(
// function(){
// $('#header #title a').trigger('click');
// } , 2000
// );
//
// }
// Chiusura modal
$("#modal__close").click(function (event) {
//var url = $("#modal_video").find('iframe').attr('src');
$("#modal-download, #modal__overlay").removeClass("active");
});
// $('.fb-share').click(function (e) {
// e.preventDefault();
//
// window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent('http://www.gravidanzaonline.it/speciale/unamammacomeme/'), 'Facebook', 'toolbar=0,status=0,width=500,height=350');
//
// return false;
// });
//
// $('.tw-share').click(function (e) {
// e.preventDefault();
//
// var twitterCard = $('meta[name="twitter:image"]');
// if ('undefined' == twitterCard) {
// $('meta').append('<meta name="twitter:image" content="http://www.gravidanzaonline.it/speciale/unamammacomeme/img/logo-be.png" />');
// }
//
// window.open('https://twitter.com/intent/tweet?text=Bepanthenol ' + encodeURIComponent('http://www.gravidanzaonline.it/speciale/unamammacomeme/'), 'Tweet', 'toolbar=0,status=0,width=500,height=350');
// return false;
// });
///////////// pulsanti slideDown-btn /////////////////
$('.slideDown-btn').click(function(e){
e.preventDefault();
$(this).parent('.slideDown-block').toggleClass('opened');
});
///////////// tab bar sidebars/////////////////
$('.sidebar-evidence__contList').height($('.sidebar-evidence__list.__list-visible').outerHeight());
$('.sidebar-evidence__tabnav a').click(function(e){
e.preventDefault();
var tab = $(this).attr('href');
// var appuntiHeight = $('#tab-appunti').outerHeight();
// var articoliHeight = $('#tab-articoli').outerHeight();
$(this).parent('li').addClass('active').siblings('li').removeClass('active');
$('.sidebar-evidence__contList').height($('#' + tab).outerHeight());
$('#' + tab).switchClass('__list-hidden', '__list-visible').siblings('.sidebar-evidence__list').switchClass('__list-visible', '__list-hidden');
});
if (($(window).width() > 667 && !$('html').hasClass('touch')) || !$('html').hasClass('touch')) {
if ($('.sticky-ele').length) {
$('.sticky-ele').stick_in_parent({offset_top: 10, inner_scrolling: false});
};
};
// var slideout = new Slideout({
// 'panel': document.getElementById('wrapper'),
// 'menu': document.getElementById('menu'),
// 'padding': 256,
// 'tolerance': 70
// });
$('.toggle-button').on('click', function() {
slideout.toggle();
});
});
// function from_social() {
// if (document.referrer.indexOf("facebook") != -1
// || document.referrer.indexOf("fb.me") != -1
// || document.referrer.indexOf("t.co") != -1
// || document.referrer.indexOf("twitter") != -1){
// return true;
// }
// return false;
// }
///////////// controlli video /////////////////
function toggleControls(obj,e) {
var video = $(obj).siblings('video')[0];
video.play();
$(obj).fadeOut();
// if (video.hasAttribute("controls")) {
// video.removeAttribute("controls");
// } else {
video.setAttribute("controls","controls");
//}
video.onpause = function() {
$(obj).fadeIn();
video.removeAttribute("controls");
};
}