小编Vig*_*ani的帖子

如何在 WooCommerce 中列出每个可下载产品的每个文件名?

我正在使用 WooCommerce 插件。在可下载的产品中,如何显示文件名而不是产品名称?现在可下载产品在“我的帐户”页面中如下所示:

title-->file1
title-->file2. 
Run Code Online (Sandbox Code Playgroud)

现在我需要将该文件列表显示为文件名。例如:在“订单”页面中,它应该是这样的:

title-->Installer.zip(filename)
title-->Runner.zip(filename)
Run Code Online (Sandbox Code Playgroud)

如何在可下载产品列表中列出每个文件名?

我正在使用 WooCommerce 2.0.4

<?php
/**
 * My Account
 */

global $woocommerce;
?>

<?php $woocommerce->show_messages(); ?>

<p><?php printf( __('Hello, <strong>%s</strong>. From your account dashboard you can view your recent orders, manage your shipping and billing addresses and <a href="%s">change your password</a>.', 'kinetico'), $current_user->display_name, get_permalink(woocommerce_get_page_id('change_password'))); ?></p>

<?php do_action('woocommerce_before_my_account'); ?>

<?php if ($downloads = $woocommerce->customer->get_downloadable_products()) : ?>
<h2><?php _e('Available downloads', 'kinetico'); ?></h2>
<ul class="digital-downloads">

    <?php foreach ($downloads as $download) : ?>

        <li><?php if (is_numeric($download['downloads_remaining'])) …
Run Code Online (Sandbox Code Playgroud)

php wordpress woocommerce woothemes

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

在jquery中创建雪花

我使用jquery创建雪花.一切似乎都没问题,但是当你点击特定的片状物时,我想做警报选项,然后它应该警告信息.但我实现了警报选项不断触发的点击功能.我不确定我错在哪里.我试过preventDefault仍然没有任何反应. http://jsfiddle.net/vicky081/4cZdu/12/

 function snowFalling(){

        // move the snow
        $('.snow').each(function(key, value){

            // check if the snow has reached the bottom of the screen
            if( parseInt($(this).css('top')) > windowHeight - 80 ) {

                // remove the snow from the HTML DOM structure
                $(this).remove();
            }       

            // set up a random speed
            var fallingSpeed = Math.floor(Math.random() * 5 + 1);

            // set up a random direction for the snow to move
            var movingDirection = Math.floor(Math.random()*2);

            // get the snow's current top
            var currentTop = parseInt($(this).css('top')); …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

循环函数导致它在javascript中无响应

这是我尝试雪花的代码.一切似乎都没问题但是一旦脚本无响应意味着一段时间(它会慢慢浏览器firefox).我不确定为什么会这样.如何在没有任何浏览器的情况下使其成为响应.这是FIDDLE

我怎样才能使它成为响应式脚本而不会引起任何问题.我认为我在循环javascript函数时犯了一个错误:(任何建议都会很棒.

谢谢

使用Javascript:

// window.setInterval(generateSnow, 0);
var windowHeight = jQuery(document).height();
var windowWidth = jQuery(window).width();
function generateSnow() {
    for (i = 0; i < 4; i++) {
        var snowTop = Math.floor(Math.random() * (windowHeight));
        snowTop = 0;

        var snowLeft = Math.floor(Math.random() * (windowWidth - 2));
        var imageSize = Math.floor(Math.random() * 20);

        jQuery('body').append(
            jQuery('<div />')
                .addClass('snow')
                .css('top', snowTop)
                .css('left', snowLeft)
                .css('position', 'absolute')
                .html('*')
        );
    }
}


function snowFalling() {
    jQuery('.snow').each(function(key, value) {
        if (parseInt(jQuery(this).css('top')) > windowHeight - 80) {
            jQuery(this).remove();
        } …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery snowflake-cloud-data-platform

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

如何在WordPress插件中使用多媒体上传器?

我尝试在wordpress插件中添加多个上传选项,我在插件中重复了这段代码(两次),只更改了id名称.

                    <script language="JavaScript">
jQuery(document).ready(function($) {
    jQuery('#upload_image_button').click(function() {
        formfield = jQuery('#upload_image').attr('name');
        tb_show('', 'media-upload.php?type=image&TB_iframe=true');
        return false;
    });

    window.send_to_editor = function(html) {
        imgurl = jQuery('img', html).attr('src');
        jQuery('#upload_image').val(imgurl);
        tb_remove();
    };

});
                    </script>
<input id="upload_image" style=" margin-left:303px;" type="text" size="36" name="upload_image_template" value="<?php echo get_option('upload_image_template'); ?>" />
                        <input id="upload_image_button" type="button" value="Browse" />
Run Code Online (Sandbox Code Playgroud)

每当我尝试上传媒体帧的图像并且上传过程成功完成时.但Insert Into Post获取正确的URL但粘贴在不同的输入框中.例如:

1) [text box1] [browse Button]
2) [text box2] [browse button]
Run Code Online (Sandbox Code Playgroud)

当我使用文本框一上传图像时,[insert post]该图像路径显示在[text box 2] 我不确定问题是我的还是该脚本不支持多文件上传选项.

javascript php wordpress wordpress-plugin

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

jquery中动画的随机颜色

我试图用ui使用jquery添加文本效果animate.是否有一种方法可以随机显示所有可能的颜色而无需定义所有颜色.例如,颜色组合基于RGB.使用带有颜色的动画

setInterval(function() {
jQuery(".font-style").animate({color: "red"}, 2000).
          animate({color: "green"}, 2000).animate({color: "blue"}, 2000);}, 400);
Run Code Online (Sandbox Code Playgroud)

是否有可能RGB在jquery中显示Randomly 的颜色组合.任何建议都会很棒.

谢谢.

javascript jquery

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

减少CSS中div的宽度移动到左侧

这里是

http://jsfiddle.net/vicky081/jmGwX/5/我想更改 div 的宽度,现在是 100%,当我将宽度更改为 50% 时,div 出现在左侧。当我减小从中心出现的 div 的大小时,如何使该 div 成为中心?可能吗?我知道 div 的宽度是,如果我将宽度更改为 50,它也会出现在100%是否有一种方法可以在我更改宽度时从中心显示它,例如:如果我减小宽度div 的那么它看起来像left 0 to right 100left to 50% right50%25% from center of left and 25% center of right

这是CSS代码:

.notify {
    background: #FFFFFF;
    width:50%;
    position: relative; 
    margin:-13px 0px 0px -5px;
    padding: 2px 0px 0px 0px;   
    border-bottom:2px solid #CC0000;
    box-shadow: 0px 4px 5px #AAAAAA;
    font-size:14px;
    font-family: 'Lato Regular', Arial;
    text-transform:uppercase;
    text-align:center;
}
Run Code Online (Sandbox Code Playgroud)

html css

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

创建Jquery插件

我用简单的警报选项创建了jquery插件.我这样做,看下面是我的代码.但它不起作用. 下面的代码是单独的js文件.

(function($) {
        $.fn.gettingmessage = function() {

            var element = this;

            $(element).load(function() {

                alertingcontent();

                function preventnextpage() {
                    return false;
                }

                function alertingcontent() {
                    alert("nicely done");
            });
        };

    })(jQuery);
Run Code Online (Sandbox Code Playgroud)

我这样称呼这个功能

     $(function(){  
  $("body").gettingmessage();  
}); 
Run Code Online (Sandbox Code Playgroud)

我不知道如何解决这个问题,任何建议都会很棒. 的jsfiddle

谢谢

javascript jquery jquery-plugins

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

使用jquery随机显示页面内的图像

我在页面内部连续尝试fadeIn fadeOut图像.我尝试了窗户高度.但是出现的图像溢出了窗口的宽度.这是FIDDLE 有没有办法在窗口内随机显示图像而不会溢出或任何东西.这里是

  var clone = drop
                    .clone()
                    .appendTo('body')

                    .css('left', Math.random() * jQuery(window).width() - 100)
                            .css('top', snowTop)
                    .html('<img src="http://i.stack.imgur.com/S9o1r.png"/>')
                    .animate({
            }, 20000, function() {
                jQuery(this).fadeIn(2000, function() {

                    jQuery(this).fadeOut(2000);
                });
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

html javascript css jquery

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

从ajax中的wordpress调用PHP函数?

reset.php文件:

 <?php 
    add_action('admin_init','popup_template_reset_options');

    function popup_template_reset_options() 
        {
        delete_option('popup_template_on');
        delete_option('popup_template_close');
        delete_option('popup_template_escape');
        delete_option('popup_template_external');
        delete_option('popup_template_home_page');
        delete_option('popup_template_all_pages');
        delete_option('popup_template_template');
        delete_option('popup_cookies_display_after_like');
        add_option('popup_cookies_display_after_like','365');
        //add_option('popup_template_on','1');
        add_option('popup_template_close','1');
        add_option('popup_template_escape','1');
        add_option('popup_template_external','1');
        add_option('popup_template_force_timer','2');
        add_option('popup_template_home_page','1');
        add_option('popup_template_all_pages','1');
        add_option('popup_template_template','2');

    }
    ?>
Run Code Online (Sandbox Code Playgroud)

脚本Ajax:

<script type="text/javascript">
    $(document).ready(function() {
        $('#reset_general').click(function()
        {
            $('#result1').css("display", "block");
            jQuery('#result1').animate({'opacity': '1'});

        });
    });
    function resetgeneral() {
        $.ajax({type: 'POST', url: '<?php echo WP_PLUGIN_URL; ?>/fantasticpopuptemplate/inc/reset.php', success: function(response) {

                //$('#fff').find('.form_result').html(response);
                $('#result1').css("display", "none");
                $('#resets1').css("display", "block");
                $('#resets1').html("Settings Resets");
                $('#resets1').fadeOut(2500, "linear");
            }});

        return false;
    }

</script>
<form onsubmit="return resetgeneral();" id="form_general_reset" class="form-1">
    <input type="submit" value="Reset" id="reset_general" name="reset" class="button-secondary"/>
    <input name="action" type="hidden" value="reset" …
Run Code Online (Sandbox Code Playgroud)

php ajax wordpress jquery

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

如何限制透明矩形区域内的对象 - FabricJS?

我正在使用FabricJS来实现设计器功能。我的想法是使用 Fabric 中的 setBackgroundImage 设置背景图像,我还添加了透明矩形的特定区域,其大小和位置从JCrop获取。现在回答我的问题,我想将对象放置限制在透明矩形的特定区域内。假设我想添加应该在该有限区域内的文本/图像/形状,我能够实现背景图像、透明矩形的位置甚至圆形对象,但我无法找到限制对象将其放置在透明矩形内的详细信息并且仅限于该地区。

这是我的下面的代码和工作小提琴,如果您在小提琴图像中看到它,您需要选择裁剪部分,并在带有透明矩形的画布背景下方,这与裁剪选择相同。现在我想限制对象放置在透明矩形中,现在我可以将对象放置在画布中的任何位置。

超文本标记语言

   <img src="https://images.unsplash.com/photo-1595438337199-d50ba5072c7e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=330&q=80" id="target">

   <div class="canvas-container" style="position: relative; user-select: none;">
     <canvas id="c1" width="600" height="600" style="border:1px solid #ccc; position: absolute;  left: 0px; top: 0px; touch-action: none; user-select: none;"></canvas>
   </div>
Run Code Online (Sandbox Code Playgroud)

JS

function calculateAspectRatioFit(srcWidth, srcHeight, maxWidth, maxHeight) {
  var ratio = Math.min(maxWidth / srcWidth, maxHeight / srcHeight);
  return {
    width: srcWidth * ratio,
    height: srcHeight * ratio,
    aspectratio: ratio
  };
}

jQuery(function($) {
    //alert("Testing");
  var img = new Image();
  img.onload = function() …
Run Code Online (Sandbox Code Playgroud)

javascript canvas html5-canvas fabricjs

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