This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const perf = window.performance; | |
| if( perf ) { | |
| var load_progress_interval = setInterval(function(){ | |
| var resources = perf.getEntriesByType("resource"); | |
| var resources_total = resources.length | |
| var resources_loaded = resources.filter(entry => entry.duration > 0).length; | |
| var load_progress = (resources_loaded / resources_total) * 100; | |
| console.log({ resources_loaded, load_progress }); | |
| }, 200); | |
| window.onload = function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Burger animation</title> | |
| <style> | |
| .burger { | |
| width: 50px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($){$(function(){ | |
| if( window.frameElement && window.frameElement.id == 'elementor-preview-iframe' ) return; | |
| var num = 12; | |
| var container = $('.categories-list'); | |
| var items = container.find('.elementor-icon-list-item'); | |
| var item_index = 0; | |
| var interval = 190; | |
| if( items.length < num ) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var el = document.querySelector('.el'); | |
| document.addEventListener('scroll', function(){ | |
| var el_scroll_percent = (window.pageYOffset + window.innerHeight - el.offsetTop) / el.offsetHeight * 1; | |
| // 0 = on screen tip of element; 1 = on screen all | |
| console.log(el_scroll_percent); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var load_complete = false; | |
| function on_page_load(){ | |
| if( load_complete ) return; | |
| load_complete = true; | |
| // scripts here ... | |
| } | |
| document.onreadystatechange = function(){ | |
| if( document.readyState === 'complete' ) { | |
| on_page_load(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $id = get_the_ID(); | |
| $name = get_the_title(); | |
| $description = get_post_meta( $id, '_yoast_wpseo_metadesc', true ); | |
| if( !$description ) { | |
| $description = get_the_excerpt( $id ); | |
| } | |
| $schema = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function pause_videos_off_screen() { | |
| if( typeof IntersectionObserver === 'undefined' ) return; | |
| let videos = document.querySelectorAll("video"); | |
| videos.forEach((video) => { | |
| if( !video.muted ) return; | |
| if( !video.paused ) video.pause(); | |
| video.io = observer = new IntersectionObserver( | |
| (entries) => { | |
| entries.forEach((entry) => { | |
| if ( entry.isIntersecting ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function videos_offscreen_pause(){ | |
| // pause if videos are off screen - to improve performance | |
| var videos = $('video'); | |
| videos.each(function(){ | |
| var el = this; | |
| el.pause(); | |
| var st_args = { | |
| trigger: el, | |
| markers: true, | |
| onEnter: function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('.horizontal_scroll_sections .elementor-widget-video').each(function(){ | |
| // i++; | |
| var el = this; | |
| var $el = $(el); | |
| // var id = 'video-'+ i; | |
| var iframe_vid; | |
| var st_args = { | |
| trigger: el, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'woocommerce_after_checkout_validation', function( $fields, $errors ){ | |
| ff_phone_number_validation( $fields, $errors ); | |
| }, 10, 2 ); | |
| function ff_phone_number_validation( $fields, $errors ){ | |
| if( isset($errors->errors['billing_phone_validation']) || isset( $errors->errors['billing_phone_required'] ) ) { | |
| return; // already validated | |
| } |