久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

默認(rèn)關(guān)閉 WooCommerce 產(chǎn)品標(biāo)簽

Close WooCommerce Product Tabs by default(默認(rèn)關(guān)閉 WooCommerce 產(chǎn)品標(biāo)簽)
本文介紹了默認(rèn)關(guān)閉 WooCommerce 產(chǎn)品標(biāo)簽的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時(shí)送ChatGPT賬號(hào)..

默認(rèn)情況下,WooCommerce 中的產(chǎn)品標(biāo)簽會(huì)自動(dòng)打開第一個(gè).是否可以默認(rèn)將它們?nèi)筷P(guān)閉,需要您單擊它才能查看更多內(nèi)容?

我嘗試了以下代碼,但似乎沒有做到.也許有一個(gè) PHP 代碼可以完成它或一些簡單的東西?

我已經(jīng)嘗試過,但運(yùn)氣不佳:

setTimeout(function() {var $tabs = jQuery( '.wc-tabs, ul.tabs' ).first();$tabs.parent().find('#tab-description').hide();$tabs.parent().find('.tab-title-description').removeClass('active');}, 10);

解決方案

更新 - 你應(yīng)該試試:

//條件顯示根據(jù)選擇的運(yùn)輸方式隱藏結(jié)帳字段add_action('wp_footer', 'close_all_product_tabs');函數(shù) close_all_product_tabs(){//僅在單個(gè)產(chǎn)品頁面上如果(!is_product())返回;?><腳本>jQuery(函數(shù)($){設(shè)置超時(shí)(功能(){$('#tab-description').hide( function(){$( 'li#tab-title-description' ).removeClass('active');});}, 200);});<?php}

此代碼位于活動(dòng)子主題(或主題)的 function.php 文件或任何插件文件中.

經(jīng)過測(cè)試并有效

<小時(shí)><塊引用>

這是對(duì)作者主題結(jié)構(gòu)的專門編輯,是定制的:

 jQuery(function($){jQuery(函數(shù)($){設(shè)置超時(shí)(功能(){$('#tab-description').hide( function(){$( 'li#description_tab' ).removeClass('active');});}, 200);});});

<小時(shí)>

現(xiàn)在在您的主題中,有一個(gè)專門用于所有內(nèi)容標(biāo)簽

容器,WooCommerce默認(rèn)沒有:

這個(gè)容器有一個(gè)灰色的邊框和一些填充,所以當(dāng)你隱藏描述選項(xiàng)卡時(shí),它就像一個(gè)帶有灰色邊框的白色扁平矩形一樣空著,這不是很好.所以你應(yīng)該隱藏它或給他0不透明度

隱藏它您可以通過許多其他方式使用:

- `$('div.tab-panels').addClass('hidden');` 以及這個(gè)隱藏"類的一些 CSS 規(guī)則- `$('div.tab-panels').css('opacity', '0');`- `$('div.tab-panels').css('visibility', 'hidden');`

一旦隱藏,您將需要在單擊按鈕時(shí)使其可見(這是更難的部分):

-`$('div.tab-panels').removeClass('hidden');`- `$('div.tab-panels').css('opacity', '1');`- `$('div.tab-panels').css('visibility', 'visible');`

最難的是讓點(diǎn)擊事件觸發(fā)這個(gè)......

By default Product Tabs in WooCommerce auto opens the first one. Is it possible to have them all closed by default, requiring you to click it to see more?

I have tried the following code, but it does not seem to do it. Perhaps there is a PHP code that does it or something simple?

I already tried this without luck:

setTimeout(function() {
    var $tabs = jQuery( '.wc-tabs, ul.tabs' ).first();
    $tabs.parent().find('#tab-description').hide();
    $tabs.parent().find( '.tab-title-description' ).removeClass('active');
}, 10);

解決方案

Updated - You should try instead:

// Conditional Show hide checkout fields based on chosen shipping methods
add_action( 'wp_footer', 'close_all_product_tabs' );
function close_all_product_tabs(){
    // Only on single product pages
    if( ! is_product() ) return;
    ?>
    <script>
        jQuery(function($){
            setTimeout(function() {
                $('#tab-description').hide( function(){
                    $( 'li#tab-title-description' ).removeClass('active');
                });
            }, 200);
        });
    </script>
    <?php
}

This code goes in function.php file of your active child theme (or theme) or also in any plugin file.

Tested and works


This is an edit specifically to the authors theme structure which is customized:

    jQuery(function($){
        jQuery(function($){
            setTimeout(function() {
                $('#tab-description').hide( function(){
                    $( 'li#description_tab' ).removeClass('active');
                });
            }, 200);
        });
    });


Now in your theme, there is specifically a <div> container for all your content tabs, that WooCommerce don't have by default:

<div class="tab-panels">

This container has a grey border and some padding, so when you hide the description tab, it stays empty like a white flat rectangle with a grey border, which is not very nice. so you should need to hide it or to give him 0 opacity

To hide it You can handle this in many other ways using:

- `$('div.tab-panels').addClass('hidden');` and some CSS rules for this 'hidden' class
- `$('div.tab-panels').css('opacity', '0');`
- `$('div.tab-panels').css('visibility', 'hidden');`

Once hidden, you will need to make it visible when a button is clicked (and this is the harder part):

- `$('div.tab-panels').removeClass('hidden');`
- `$('div.tab-panels').css('opacity', '1');`
- `$('div.tab-panels').css('visibility', 'visible');`

The hardest thing will be to get the click event to trigger this…

這篇關(guān)于默認(rèn)關(guān)閉 WooCommerce 產(chǎn)品標(biāo)簽的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Add programmatically a downloadable file to Woocommerce products(以編程方式將可下載文件添加到 Woocommerce 產(chǎn)品)
Get today#39;s total orders count for each product in Woocommerce(獲取今天 Woocommerce 中每種產(chǎn)品的總訂單數(shù))
Add Custom registration fields in WooCommerce and phone field validation issue(在 WooCommerce 和電話字段驗(yàn)證問題中添加自定義注冊(cè)字段)
Add a select field that will change price in Woocommerce simple products(在 Woocommerce 簡單產(chǎn)品中添加一個(gè)將更改價(jià)格的選擇字段)
Add custom columns to admin products list in WooCommerce 3(在 WooCommerce 3 中將自定義列添加到管理產(chǎn)品列表)
Customizing checkout quot;Place Orderquot; button output html(自定義結(jié)帳“下訂單按鈕輸出html)
主站蜘蛛池模板: 国产精品2区| 久久久久久国产 | 日本一级淫片免费啪啪3 | 国产一级片 | 国产精品久久久久久久久久久久久 | 在线观看成年人视频 | 精品国产亚洲一区二区三区大结局 | 久久国产福利 | 欧美激情欧美激情在线五月 | 国产欧美一区二区三区在线播放 | 久久99精品久久久久久国产越南 | 精品久久久久久久久亚洲 | 久久亚洲一区 | 日韩手机视频 | 成人精品一区二区三区四区 | 天天操一操 | 亚洲xx在线 | 久久99蜜桃综合影院免费观看 | 欧美日韩高清 | 国产99视频精品免费播放照片 | 亚洲精品一区二区 | 日本精品一区二区在线观看 | 久久综合久久综合久久 | 欧美国产中文字幕 | 91国在线高清视频 | 一本色道精品久久一区二区三区 | 天天干狠狠 | 精品国产乱码久久久久久丨区2区 | 亚洲成人网在线 | 日韩国产一区二区 | 亚洲有码转帖 | 精品日韩一区二区 | 午夜综合 | 日韩一区二区福利视频 | 国产超碰人人爽人人做人人爱 | av网站在线看 | 欧美色人 | 婷婷福利视频导航 | 91精品国产91久久久久久最新 | 久久99精品国产麻豆婷婷 | 国产精品夜间视频香蕉 |