久久久久久久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)
主站蜘蛛池模板: 亚洲嫩草| 成年人免费网站 | 国产精品久久久久久久久久久免费看 | 成人在线一区二区 | 午夜成人免费视频 | 中文字幕二区三区 | 成人一区二区三区在线 | 久久新| 中文字幕精品视频在线观看 | 成人国内精品久久久久一区 | 日韩色视频 | 国产免费麻豆视频 | 色综合久久久久 | 亚洲一区免费在线 | 国产亚洲一区二区三区在线观看 | 国产电影一区二区三区爱妃记 | 久久精品免费观看 | 风间由美一区二区三区在线观看 | 国产一区二 | 99热99 | 亚洲成人国产综合 | 国产成人精品免高潮在线观看 | www日本高清 | 国产精品视频综合 | 精品欧美一区二区三区久久久 | 中文在线视频观看 | 久久久久国产精品免费免费搜索 | 日韩高清一区 | 国产乱码精品一品二品 | 久久久久久久久久久一区二区 | 真人一级毛片 | 精品国产欧美 | 亚洲国产精品激情在线观看 | 亚洲一区二区网站 | 狠狠爱综合 | 在线播放中文字幕 | 亚洲一区国产精品 | 欧美精品一区三区 | 九九精品在线 | 国产精品美女久久久久久久久久久 | 亚洲黄色在线免费观看 |