2 deleted 111 characters in body
source | link

I have this script that automatically scrolls down to the primary content on page load.

jQuery(document).ready(function($){
                        if ( $(window).width() < 768 || window.Touch) { 
                            $('html, body').animate({
            scrollTop: $("#primary").offset().top
        }, 2000);
                        } 
    });

1. However I would like to only apply it to our woocommerce product pages and categories so it doesnt work on home/blog pages. How would i do that? 

I can do this poorly by editing woocommerceWooCommerce core files but i know thatsthat's a horrible idea so imI'm seeking out help on how to do it correctly via my functions.php file.

2. Also i would like to know how to apply it to all pages except the home page should that be a better option later on.

Many thanks!

I have this script that automatically scrolls down to the primary content on page load.

jQuery(document).ready(function($){
                        if ( $(window).width() < 768 || window.Touch) { 
                            $('html, body').animate({
            scrollTop: $("#primary").offset().top
        }, 2000);
                        } 
    });

However I would like to only apply it to our woocommerce product pages and categories so it doesnt work on home/blog pages. How would i do that? I can do this by editing woocommerce core files but i know thats a horrible idea so im seeking out help on how to do it correctly via my functions.php file.

Also i would like to know how to apply it to all pages except the home page should that be a better option later on.

Many thanks!

I have this script that automatically scrolls down to the primary content on page load.

jQuery(document).ready(function($){
  if ( $(window).width() < 768 || window.Touch) { 
    $('html, body').animate({ scrollTop: $("#primary").offset().top}, 2000);} 
});

1. However I would like to only apply it to our woocommerce product pages and categories so it doesnt work on home/blog pages. How would i do that? 

I can do this poorly by editing WooCommerce core files but i know that's a horrible idea so I'm seeking out help on how to do it correctly via my functions.php file.

2. Also i would like to know how to apply it to all pages except the home page should that be a better option later on.

Many thanks!

1
source | link

Apply jquery script to only woocommerce product pages and categories

I have this script that automatically scrolls down to the primary content on page load.

jQuery(document).ready(function($){
                        if ( $(window).width() < 768 || window.Touch) { 
                            $('html, body').animate({
            scrollTop: $("#primary").offset().top
        }, 2000);
                        } 
    });

However I would like to only apply it to our woocommerce product pages and categories so it doesnt work on home/blog pages. How would i do that? I can do this by editing woocommerce core files but i know thats a horrible idea so im seeking out help on how to do it correctly via my functions.php file.

Also i would like to know how to apply it to all pages except the home page should that be a better option later on.

Many thanks!