久久久久久久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)
主站蜘蛛池模板: 日韩欧美亚洲综合 | 亚洲三区视频 | 99re在线视频观看 | 91免费视频| 99re在线观看 | 一区二区三区国产好 | 看av电影| 日本在线视 | av免费网站在线观看 | 欧美一区二区大片 | 亚州午夜精品 | 99久久国产综合精品麻豆 | 国产精品久久久久久久久久久久午夜片 | 蜜桃视频在线观看www社区 | 国产一区二区精 | 欧美性大战xxxxx久久久 | 欧美综合一区 | 天天干狠狠干 | 日韩欧美在线视频观看 | 久久爱黑人激情av摘花 | gogo肉体亚洲高清在线视 | 999精彩视频| 日韩中文字幕在线观看 | 婷婷毛片 | 久热电影| 久久69精品久久久久久久电影好 | 一区二区视频 | 一级毛片视频免费观看 | 国产精品视频久久久 | 黄色片在线免费看 | 欧美日韩一区在线播放 | 成年视频在线观看 | 国产毛片在线看 | 中文字幕国产在线 | 国产福利精品一区 | 午夜视频免费网站 | 国产在线视频一区二区董小宛性色 | 国产在线观看一区二区三区 | 日韩精品一区二区久久 | 夜夜草| 黄色毛片在线观看 |