javascript - How do i link my "add to cart" button to a specific on page tab and scroll to it when clicked? -
previously trying create , alternate "add cart" button on single-product-page of woocommerce website. now, button link tab on same page, have page scroll down , switch tab when button clicked.
this need happen no know how implement in wordpress setting.
so settled creating js script suggestion of place
<script type="text/javascript"> if ( location.href.match(/#tab-reviews/g) !== null ) { jquery( '#tab-reviews' ).show(); jquery( 'li.reviews_tab a' ).trigger('click'); } </script> then called word press through funtion.php file this, not working.
function tab_scroll() { wp_enqueue_script('custom-script', get_stylesheet_directory_uri() . '/tab_scroll.js', array( 'jquery' )); } add_action( 'wp_enqueue_scripts', 'tab_scroll' ); i dont know if way called script or script not written suit needs or written properly
what help/suggestions on making first script work me. , on bringing wordpress.
Comments
Post a Comment