Skip to content

Instantly share code, notes, and snippets.

First identify the touch device by adding the following javascript (jQuery):
if ("ontouchstart" in document.documentElement){
$('html').addClass('touch');
}
Then add the following line to thickbox.css:
@sharkyak
sharkyak / common.js
Created June 23, 2016 08:50
webflow animation
$('#uslugi-menu').hover(function() {
var ix = Webflow.require('ix');
var trigger1 = {"type":"hover","selector":".ts-navbar-submenu-wrap","stepsA":[{"display":"block"},{"opacity":1,"transition":"opacity 500ms ease 0ms"}],"stepsB":[]};
ix.run(trigger1);
});
@sharkyak
sharkyak / common.js
Created August 2, 2016 08:12
jQuery smooth page scroll
$('a[href*="#"]:not([href="#"])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
@sharkyak
sharkyak / common.js
Created August 2, 2016 13:45
prevent img drag
$("img, a").on("dragstart", function(event) { event.preventDefault(); });
@sharkyak
sharkyak / functions.php
Created August 26, 2016 06:16
woocommerce remove reviews tab
remove_action('woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20);
add_filter( 'woocommerce_product_tabs', 'wcs_woo_remove_reviews_tab', 98 );
function wcs_woo_remove_reviews_tab($tabs) {
unset($tabs['reviews']);
return $tabs;
}
@sharkyak
sharkyak / functions.php
Created August 26, 2016 09:58
woocommerce remove add to cart button
function remove_loop_button(){
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
}
add_action('init','remove_loop_button');
@sharkyak
sharkyak / functions.php
Created August 26, 2016 10:08
woocommerce change add to cart button to view product
add_filter( 'woocommerce_loop_add_to_cart_link', 'change_add_to_cart_loop' );
function change_add_to_cart_loop( $product ) {
global $product; // this may not be necessary as it should have pulled the object in already
return '<a href="' . esc_url( $product->get_permalink( $product->id ) ) . '">READ MORE</a>';
}
@sharkyak
sharkyak / functions.php
Created August 26, 2016 15:06
woocommerce remove add to cart button
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_simple_add_to_cart', 'woocommerce_simple_add_to_cart', 30 );
remove_action( 'woocommerce_grouped_add_to_cart', 'woocommerce_grouped_add_to_cart', 30 );
@sharkyak
sharkyak / functions.php
Created August 27, 2016 04:49
wordpress breadcrumbs
/*
* "Хлебные крошки" для WordPress
* автор: Dimox
* версия: 2015.09.14
* лицензия: MIT
*/
function dimox_breadcrumbs() {
/* === ОПЦИИ === */
$text['home'] = 'Главная'; // текст ссылки "Главная"
@sharkyak
sharkyak / functions.php
Created August 28, 2016 08:55
wordpress json api remove
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );