小编Vin*_*ent的帖子

WooCommerce - 按product_id获取产品说明

如何使用产品ID获取产品说明或产品对象.

$order = new WC_Order($order_id);

foreach ($order->get_items() as $item) {
    $product_description = get_the_product_description($item['product_id']); // is there any method can I use to fetch the product description?
}
Run Code Online (Sandbox Code Playgroud)

上面的代码扩展了类WC_Payment_Gateway

任何帮助将不胜感激.

php wordpress product orders woocommerce

6
推荐指数
2
解决办法
4万
查看次数

带有xlink的SVG <use>:href在Edge中不起作用

我在Edge中遇到奇怪的行为,它没有调用同一文档中<paths>定义.虽然这只发生在我的应用程序中,但没有发生在样式指南上.此外,我不认为这是一个边缘问题,因为基于微软文档他们支持属性.xlink:href

风格指南(在Edge中查看) 在此输入图像描述 从这里你可以看到svg图标渲染得很好,但是从控制台(DOM资源管理器)中<use>元素被使用并通过ID而不是外部svg资源引用每个路径.小提琴:https://jsfiddle.net/kfL7tbcf/

Web App(缺少svg) 在此输入图像描述 在Web应用程序中,当我尝试使用SVG时,它没有获得引用的元素.小提琴:https://jsfiddle.net/kfL7tbcf/

Web App(没有<use>元素的svg ) 在此输入图像描述 没有<use>元素,SVG显示正常.小提琴:https://jsfiddle.net/9uuLr9gd/

任何想法和帮助将不胜感激.谢谢!

html svg microsoft-edge

6
推荐指数
1
解决办法
3018
查看次数

创建垂直图像轮播

我正在尝试创建一个自定义垂直图像轮播,因为我不能使用任何插件,因为附加到我需要保留的图像的js事件,唯一可行的方法是创建自定义轮播.

功能

  • 图像轮播在视口中具有3个相同的大小.
  • 图像轮播确实有下一个/上一个按钮,允许您查看/选择更多图像.
  • 下一个/上一个按钮一次只允许一个步骤,这意味着它不会选择下一组图像并在视口中显示它.

在此输入图像描述

  • Carousel允许您选择视口中的任何图像,这将在单击下一个/上一个按钮时同步

在此输入图像描述

上面列出的所有功能都已实现.

问题

最后一个图像不会在下一个按钮之前捕捉/停止,因为它会在两个按钮之间创建空白区域.

在此输入图像描述在此输入图像描述

JS代码

$(function(){
        var image_height = 0;
        var gallery_offset = 0;
        var image_count = $('img.thumbnail').length;
        var click_count = 0;
        var image_height = 0;
        var last_images_count = 0;

        $('.gallery-container a').click(function(){
          $('.gallery-container a').removeClass('active')
            $(this).addClass('active');

        });

        jQuery('.thumbnail').each(function(){
          $(this).on('load', function(){ image_height = $(this).parent().outerHeight(); });
          image_height = $(this).parent().outerHeight();
        })

        // Disable arrows if the images count is 3 below
        if(image_count <= 3) {
            $('.product-more-pictures .up, .product-more-pictures .down').addClass('disabled')
            click_count = 0;
        }

        // Set the first …
Run Code Online (Sandbox Code Playgroud)

javascript jquery carousel

5
推荐指数
1
解决办法
426
查看次数

Slick Carousel上的Twitter Boostrap工具提示

如何在Slick Carousel中显示Twitter Bootstrap工具提示?

至于现在,当我徘徊每个图像时,工具提示位于图像的顶部,但由于转盘的容器/包装器位于绝对位置,因此无法显示.

在此输入图像描述

光滑轮播的HTML标记

<div class="slider center slick-initialized slick-slider">
    <div class="slick-list draggable">
        <div class="slick-slide slick-cloned" style="width: 197px;">
            <img src="assets/css/images/paid-ad-2.jpg" class="img-responsive" data-toggle="tooltip" data-placement="top" title="" data-original-title="Aparment Unit in Arkansas">
        <div class="slick-slide slick-cloned" style="width: 197px;">
            <img src="assets/css/images/paid-ad-2.jpg" class="img-responsive" data-toggle="tooltip" data-placement="top" title="" data-original-title="Aparment Unit in Arkansas">
        </div><!-- And so on... -->
    </div>
</div> 
Run Code Online (Sandbox Code Playgroud)

Twitter Bootstrap工具提示的HTML标记

<div class="tooltip fade top in" style="display: block; top: -32px; left: 49px;">
    <div class="tooltip-arrow"></div>
    <div class="tooltip-inner">Hidden tooltip</div>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

.slick-list …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery twitter-bootstrap

4
推荐指数
1
解决办法
2463
查看次数

使用 sass @each 或 @for 控制指令进行循环边距偏移

我是 sass 的新手,在练习时遇到了这种情况。

如何实现具有不同值偏移的上边距、右边距、下边距和左边距列表(我知道这可能听起来不清楚)。

所以这是 .scss 生成的 .css 文件的输出(应该是)

.offset-top-1{
    margin-top: 1rem;
}
.offset-top-2{
    margin-top: 2rem;
}
.offset-top-3{
    margin-top: 3rem;
}
//.... so on to .offset-top-6 and also for .offset-right-x, .offset-bottom-x, and .offset-left-x
Run Code Online (Sandbox Code Playgroud)

这是我的 .scss 文件

    @mixin offset-margin($margins){
        margin: $margins;
    }

    @for $i from 1 through 20 {
        .offset-top-#{$i}{
            @include offset-margin(1rem * $i 0rem 0rem 0rem); // the other offset values should be removed since I'm dealing only for margin-top
        }
        .offset-right-#{$i}{
            @include offset-margin( 0rem 1rem * $i 0rem 0rem); …
Run Code Online (Sandbox Code Playgroud)

html css sass

2
推荐指数
1
解决办法
3151
查看次数