Skip to content

Instantly share code, notes, and snippets.

$(window).on('scroll', function () {
if($('html').scrollTop()>60){
$('html').addClass('sticky');
} else {
$('html').removeClass('sticky');
}
});
@slaffko1
slaffko1 / functions.php
Created February 13, 2019 21:06 — forked from schilke/functions.php
How to load CSS files asynchronously in WordPress (using Scott Jehl's "loadCSS")
<?php
// This is the cleaner code per request of a thread in the LinkedIn group "WordPress"
// ...
// register and enqueue loadCSS
function load_scripts_and_styles() {
// register loadCSS
wp_register_script( 'load-css-async', get_stylesheet_directory_uri() . '/path/to/js/loadCSS.js', array(), '', false );
@slaffko1
slaffko1 / functions.php
Created March 22, 2019 18:11 — forked from kloon/functions.php
WooCommerce Remove Product Description from single product pages
<?php
// remove product description from single product pages
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_filter( 'woocommerce_product_tabs', 'wc_remove_description_tab', 11, 1 );
function wc_remove_description_tab( $tabs ) {
if ( isset( $tabs['description'] ) ) {
unset( $tabs['description'] );
}
}
?>
const $menu = $('.dropdown');
$(document).mouseup(function (e) {
if (!$menu.is(e.target) // if the target of the click isn't the container...
&& $menu.has(e.target).length === 0) // ... nor a descendant of the container
{
$menu.removeClass('is-active');
}
});
// getCookie(), setCookie(), deleteCookie()
// возвращает cookie если есть или undefined
function getCookie(name) {
var matches = document.cookie.match(new RegExp(
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
))
return matches ? decodeURIComponent(matches[1]) : undefined
@slaffko1
slaffko1 / ie67891011-css-hacks.txt
Last active July 17, 2019 18:05 — forked from vidaaudrey/ie67891011-css-hacks.txt
IE CSS hacks - IE6, 7, 8, 9, 10, 11
IE6 Only
==================
_selector {...}
IE6 & IE7
==================
*html or { _property: }
IE7 Only
==================
<fieldset>
<legend>You can edit messages used in various situations here. For details, see <a href="https://contactform7.com/editing-messages/">Editing Messages</a>.</legend>
<p class="description">
<label for="wpcf7-message-mail-sent-ok">Sender's message was sent successfully<br>
<input type="text" id="wpcf7-message-mail-sent-ok" name="wpcf7-messages[mail_sent_ok]" class="large-text" size="70" value="תודה לך על הודעתך, ההודעה נשלחה." data-config-field="messages.mail_sent_ok">
</label>
</p>
<p class="description">
<label for="wpcf7-message-mail-sent-ng">Sender's message failed to send<br>
<input type="text" id="wpcf7-message-mail-sent-ng" name="wpcf7-messages[mail_sent_ng]" class="large-text" size="70" value="בעת שליחת הודעתך אירע שגיאה, אנה נסה שנית מאוחר יותר." data-config-field="messages.mail_sent_ng">
@slaffko1
slaffko1 / gist:8e1e0f6314a9eedab1cdb99cfce68e22
Created September 3, 2019 12:32 — forked from Neolot/gist:3964380
PHP Склонение числительных
<?php
/**
* Функция склонения числительных в русском языке
*
* @param int $number Число которое нужно просклонять
* @param array $titles Массив слов для склонения
* @return string
**/
$titles = array('котик', 'котика', 'котиков');
function declOfNum($number, $titles)
@slaffko1
slaffko1 / function.php
Created September 9, 2019 18:39
dequeue styles
add_action( 'wp_print_styles', 'dequeue_font_awesome_style' );
function dequeue_font_awesome_style() {
wp_dequeue_style( 'elementor-icons' );
wp_deregister_style( 'elementor-icons' );
wp_dequeue_style( 'font-awesome' );
wp_deregister_style( 'font-awesome' );
wp_dequeue_style( 'fontawsome' );
wp_deregister_style( 'fontawsome' );
@slaffko1
slaffko1 / jquery-scroll-bottom.js
Created October 24, 2019 15:16 — forked from toshimaru/jquery-scroll-bottom.js
Detect the scrolling to bottom of the page using jQuery.
$(window).on("scroll", function() {
var scrollHeight = $(document).height();
var scrollPosition = $(window).height() + $(window).scrollTop();
if ((scrollHeight - scrollPosition) / scrollHeight === 0) {
// when scroll to bottom of the page
}
});