File: /home/storage/162/3480162/user/htdocs/wp-content/plugins/envo-magazine-pro/js/envo-magazine-pro.js
/**
* jQuery simple Ticker plugin
*
* Copyright (c) 2012 miraoto
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* ticker plugin
*
* @name $.simpleTiecker();
* @cat Plugins/Preload
* @author miraoto
*
* @example $.simpleTiecker();
* @desc default setting
*/
( function ( $ ) {
$.simpleTicker = function ( element, options ) {
var defaults = {
speed: 1000,
delay: 3000,
easing: 'swing',
effectType: 'slide'
}
var param = {
'ul': '',
'li': '',
'initList': '',
'ulWidth': '',
'liHeight': '',
'tickerHook': 'tickerHook',
'effect': { }
}
var plugin = this;
plugin.settings = { }
var $element = $( element ),
element = element;
plugin.init = function () {
plugin.settings = $.extend( { }, defaults, options );
param.ul = element.children( 'ul' );
param.li = element.find( 'li' );
param.initList = element.find( 'li:first' );
param.ulWidth = param.ul.width();
param.liHeight = param.li.height();
element.css( { height: ( param.liHeight ) } );
param.li.css( { top: '0', left: '0', position: 'absolute' } );
//dispatch
switch ( plugin.settings.effectType ) {
case 'fade':
plugin.effect.fade();
break;
case 'roll':
plugin.effect.roll();
break;
case 'slide':
plugin.effect.slide();
break;
}
plugin.effect.exec();
}
plugin.effect = { };
plugin.effect.exec = function () {
param.initList.css( param.effect.init.css )
.animate( param.effect.init.animate, plugin.settings.speed, plugin.settings.easing )
.addClass( param.tickerHook );
if ( element.find( param.li ).length > 1 ) {
setInterval( function () {
element.find( '.' + param.tickerHook )
.animate( param.effect.start.animate, plugin.settings.speed, plugin.settings.easing )
.next()
.css( param.effect.next.css )
.animate( param.effect.next.animate, plugin.settings.speed, plugin.settings.easing )
.addClass( param.tickerHook )
.end()
.appendTo( param.ul )
.css( param.effect.end.css )
.removeClass( param.tickerHook );
}, plugin.settings.delay );
}
}
plugin.effect.fade = function () {
param.effect = {
'init': {
'css': { display: 'block', opacity: '0' },
'animate': { opacity: '1', zIndex: '98' }
},
'start': {
'animate': { opacity: '0' }
},
'next': {
'css': { display: 'block', opacity: '0', zIndex: '99' },
'animate': { opacity: '1' }
},
'end': {
'css': { display: 'none', zIndex: '98' }
}
}
}
plugin.effect.roll = function () {
param.effect = {
'init': {
'css': { top: '3em', display: 'block', opacity: '0' },
'animate': { top: '0', opacity: '1', zIndex: '98' }
},
'start': {
'animate': { top: '-3em', opacity: '0' }
},
'next': {
'css': { top: '3em', display: 'block', opacity: '0', zIndex: '99' },
'animate': { top: '0', opacity: '1' }
},
'end': {
'css': { zIndex: '98' }
}
}
}
plugin.effect.slide = function () {
param.effect = {
'init': {
'css': { left: ( 200 ), display: 'block', opacity: '0' },
'animate': { left: '0', opacity: '1', zIndex: '98' }
},
'start': {
'animate': { left: ( -( 200 ) ), opacity: '0' }
},
'next': {
'css': { left: ( param.ulWidth ), display: 'block', opacity: '0', zIndex: '99' },
'animate': { left: '0', opacity: '1' }
},
'end': {
'css': { zIndex: '98' }
}
}
}
plugin.init();
}
$.fn.simpleTicker = function ( options ) {
return this.each( function () {
if ( undefined == $( this ).data( 'simpleTicker' ) ) {
var plugin = new $.simpleTiecker( this, options );
$( this ).data( 'simpleTicker', plugin );
}
} );
}
} )( jQuery );
/**
* jQuery Unveil
* A very lightweight jQuery plugin to lazy load images
* http://luis-almeida.github.com/unveil
*
* Licensed under the MIT license.
* https://github.com/luis-almeida
*/
;
( function ( $ ) {
$.fn.unveil = function ( threshold, callback ) {
var $w = $( window ),
th = threshold || 0,
retina = window.devicePixelRatio > 1,
attrib = retina ? "data-src-retina" : "data-src",
images = this,
loaded;
this.one( "unveil", function () {
var source = this.getAttribute( attrib );
source = source || this.getAttribute( "data-src" );
if ( source ) {
this.setAttribute( "src", source );
if ( typeof callback === "function" )
callback.call( this );
}
} );
function unveil() {
var inview = images.filter( function () {
var $e = $( this );
if ( $e.is( ":hidden" ) )
return;
var wt = $w.scrollTop(),
wb = wt + $w.height(),
et = $e.offset().top,
eb = et + $e.height();
return eb >= wt - th && et <= wb + th;
} );
loaded = inview.trigger( "unveil" );
images = images.not( loaded );
}
$w.on( "scroll.unveil resize.unveil lookup.unveil", unveil );
unveil();
return this;
};
} )( window.jQuery || window.Zepto );
jQuery( document ).ready( function ( $ ) {
$( '.news-ticker-section' ).each( function () {
var id = $( '.newsticker' ).data( 'id' );
$.simpleTicker( $( '#newsticker-' + id ), {
delay: 5000,
effectType: 'slide',
speed: 1500
} );
} );
// Slider
$( '.slider-single-item' ).slick();
// Carousel one
$( '.carousel-slick' ).slick( {
infinite: true,
speed: 300,
slidesToShow: 3,
slidesToScroll: 1,
responsive: [
{
breakpoint: 992,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 768,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
]
} );
$( '.carousel-center' ).slick( {
centerMode: true,
slidesToShow: 3,
responsive: [
{
breakpoint: 768,
settings: {
arrows: true,
centerMode: true,
slidesToShow: 1
}
}
]
} );
$( '.slider-single-item-for' ).slick( {
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
asNavFor: '.slider-single-item-sync'
} );
$( '.slider-single-item-sync' ).slick( {
slidesToShow: 5,
slidesToScroll: 1,
asNavFor: '.slider-single-item-for',
dots: false,
centerMode: true,
focusOnSelect: true,
responsive: [
{
breakpoint: 768,
settings: {
arrows: false,
}
}
]
} );
document.addEventListener("touchmove", ScrollStart, false);
document.addEventListener("scroll", Scroll, false);
function ScrollStart() {
//start of scroll event for iOS
$(window).trigger("lookup");
}
function Scroll() {
//end of scroll event for iOS
//and
//start/end of scroll event for other browsers
$(window).trigger("lookup");
}
// Lazy load images
$( "img" ).unveil( 80, function () {
$( this ).load( function () {
this.style.opacity = 1;
masonry_update();
slider_update();
carousel_update();
} );
} );
function masonry_update() {
if ( $( '.masonry-inner' ).length ) {
var $works_list = $( '.masonry-inner' );
$works_list.imagesLoaded( function () {
$works_list.masonry( {
itemSelector: '.masonry-item'
} );
} );
}
}
function slider_update() {
$('.slider-single-item-for').on('setPosition', function(event, slick){
$(".slider-single-item-for img").trigger("lookup");
});
$('.slider-single-item-sync').on('setPosition', function(event, slick){
$(".slider-single-item-sync img").trigger("lookup");
});
$('.slider-single-item').on('setPosition', function(event, slick){
$(".slider-single-item img").trigger("lookup");
});
}
function carousel_update() {
$('.carousel-slick').on('setPosition', function(event, slick){
$(".carousel-slick img").trigger("lookup");
});
$('.carousel-center').on('setPosition', function(event, slick){
$(".carousel-center img").trigger("lookup");
});
}
if ( $( '.masonry-inner' ).length ) {
var $grid = $( '.masonry-inner' ).imagesLoaded( function () {
$grid.masonry( {
itemSelector: '.masonry-item'
} );
} );
}
} );
// Content slider in single post
jQuery( document ).ready( function ( $ ) {
var $myDiv = $( '#slidebox' );
if ( $myDiv.length ) {
$( window ).scroll( function () {
var distanceTop = $( '.ad-after-content' ).offset().top - $( window ).height();
if ( $( window ).scrollTop() > distanceTop )
$( '#slidebox' ).animate( { 'bottom': '0px' }, 300 );
else
$( '#slidebox' ).stop( true ).animate( { 'bottom': '-400px' }, 100 );
} );
$( '#slidebox .close-me' ).bind( 'click', function () {
$( this ).parent().remove();
} );
}
;
} );
jQuery( document ).ready( function ( $ ) {
$( ".tab_content_login" ).hide();
$( "ul.tabs_login li:first" ).addClass( "active_login" ).fadeIn( 450 );
$( ".tab_content_login:first" ).fadeIn( 450 );
$( "ul.tabs_login li" ).click( function () {
$( "ul.tabs_login li" ).removeClass( "active_login" );
$( this ).addClass( "active_login" );
$( ".tab_content_login" ).hide();
var activeTab = $( this ).find( "a" ).attr( "href" );
$( activeTab ).fadeIn( 450 );
return false;
} );
} );