您可以将这些显示规则添加到类中,然后基于window.location
将其动态添加到主体中。
仅当窗口URL为CSS
]时,我才想加载以下https://mywebsite.com/my-account/return
CSS:
<style>.shop table.shop_table.my_account_orders>tbody>tr{
display: table-row !important;}
.shop table.shop_table.my_account_orders>tbody>tr>td{
display: table-cell !important;}
.shop table.shop_table.my_account_orders>tbody>tr>td:before{
display: table-row !important;}</style>
仅当窗口URL为https://mywebsite.com/my-account/return CSS时,我才想加载以下CSS:
您可以将这些显示规则添加到类中,然后基于window.location
将其动态添加到主体中。
您的CSS规则看起来像这样(请注意新的.mywebsite-com-my-account-return
类:]
<style> .mywebsite-com-my-account-return .shop table.shop_table.my_account_orders>tbody>tr { display: table-row !important; } .mywebsite-com-my-account-return .shop table.shop_table.my_account_orders>tbody>tr>td { display: table-cell !important; } .mywebsite-com-my-account-return .shop table.shop_table.my_account_orders>tbody>tr>td:before { display: table-row !important; } </style>
然后您的Javascript如下所示:
<script>
if (window.location.href === "https://mywebsite.com/my-account/return") {
document.querySelector("body").classList.add("mywebsite-com-my-account-return")
}
</script>
您可以将这些显示规则添加到类中,然后基于window.location
将其动态添加到主体中。