小编ale*_*wc_的帖子

WordPress:使用enqueue加载多个脚本

我正在尝试将jQuery和其他脚本加载到标题中(或者它应该是页脚),并且我有jQuery工作类型我可以运行警报框.

问题是,jquery-2.0.3.min.js没有加载,我不知道我是否正确地进行了入队.虽然加载了jquery-1.10.2.而且,另一个脚本也没有加载.对于这两个脚本(2.0.3和其他脚本),这是最后的:?ver=3.6.1

另外我读到可能更好地将两者加载到一个函数中?

所以,任何帮助将不胜感激!

function load_jquery() {
    wp_register_script( 'jquery_script', get_template_directory_uri() . 'js/jquery-2.0.3.min.js', array( 'jquery' ) );
    wp_enqueue_script( 'jquery_script' );
}
add_action( 'init', 'load_jquery' ); // end jQuery

function another() {
    wp_register_script( 'another_script', get_template_directory_uri() . 'js/another.js', array( 'jquery' ) );
    wp_enqueue_script( 'another_script' );

}
add_action( 'init', 'another' );
Run Code Online (Sandbox Code Playgroud)

php wordpress

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

缺少'()'调用构造函数

我有以下代码返回当前年份(我也在jsFiddle中有它).jsFiddle不断给我一个错误:"Missing'()'调用一个构造函数",我不知道它意味着什么或如何摆脱它.代码仍然有效,但我想知道导致错误的原因是什么:

HTML:

jQuery的:

var currentYear = (new Date).getFullYear();
$(document).ready(function() {
    $("#year").text(currentYear);
});
Run Code Online (Sandbox Code Playgroud)

谢谢!

javascript jquery

7
推荐指数
1
解决办法
5832
查看次数

jQuery slideToggle:最后跳跃

刚刚为.slideToggle写了一些"阅读更多... /阅读更少...",问题是在幻灯片结束时,动画"跳",因为缺乏更好的描述.同样,当幻灯片再次启动时.有什么建议?

我在jsFiddle里有它

编辑:我正在使用Chrome

<div class="details">
<p>I am an excerpt.</p>
    <span class="show">Read More...</span>

        <div class="info">
        <p>the info to show in here......</p>
        </div>
        </div> <!-- details -->

<div class="details">
<p>I am an excerpt.</p>
    <span class="show">Read More...</span>

        <div class="info">
        <p>Some different info to show in here......</p>
        </div>
        </div> <!-- details -->

$(document).ready(function (){

    $(".info").hide();
        $(".show").click(function(event) {
        $(this).parent(".details").children("div.info").slideToggle(300);
        $(this).text($(this).text() == 'Read More...' ? 'Read Less...' : 'Read More...');
    });

});
Run Code Online (Sandbox Code Playgroud)

谢谢!

jquery slidetoggle

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

retina.js不工作 - 不知道为什么

我没有太多的代码可以放入,但寻求帮助以保存头发留在我头上...

我正在使用retina.js,它不适用于任何图像.@ 2x图像与较小图像位于同一文件夹中.一个如果它们的大小不是两倍 - 设计师发给我的是一个或两个像素的图像 - 所以我不会担心那个,因为我假设一旦其他图像被加载,这个将在大小时工作正确.

我尝试过简写背景:url(foo.jpg)....和background-image:url(foo.jpg),有和没有""中的图像.我已经辞职,以为我错过了一些愚蠢的东西,我只是没有看到它.任何帮助,将不胜感激!

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="../js/index.js"></script>
<script type="text/javascript" src="../js/retina.js"></script>
Run Code Online (Sandbox Code Playgroud)

HTML:

<ul class="grid" id="movie-grid">
<li class="movie">
  <div class="poster"></div>
  <h2 class="title"><a href="foo.html">Title</a></h2>
  <p class="desc">TV Movie</p>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)

和CSS:

    .poster {
 /*background:url(../images/comingsoon.jpg) no-repeat left top;*/
 background-image:url(../images/comingsoon.jpg);
 background-repeat:no-repeat;
 background-position:left top;
 display:block;
 width:204px;
 height:137px;
 background-size:100%;

 }
Run Code Online (Sandbox Code Playgroud)

javascript image retina.js

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

悬停时的小CSS动画

试图创造这样的东西. 在此输入图像描述

我无法使用letter-spacing.我创建此代码,但它不能很好地工作.

http://jsfiddle.net/pyqq8wfe/

.refreshed_logo {
  font-family: ProximaNovaBold;
  font-size: 50px;
  text-decoration: none;
  color: #000000;
}
.logo_wrapper {
  color: inherit;
  text-decoration: none;
  width: 250px;
  position: absolute;
}
.refreshed_logo:after {
  content: 'digital';
  width: 20px;
  height: 20px;
  text-align: center;
  position: absolute;
  font-size: 20px;
  background-color: red;
  border-radius: 18px;
  color: white;
  margin-left: 4px;
  margin-top: 3px;
  text-indent: 8px;
  font-weight: normal;
  line-height: 1;
  transition-property: width, height;
  transition-duration: 0.2s, 0.2s;
  transition-delay: 0s, 0.2s;
  -o-transition-property: width, height;
  -o-transition-duration: 0.2s, 0.2s;
  -o-transition-delay: 0s, 0.2s;
  -moz-transition-property: width, height;
  -moz-transition-duration: 0.2s, …
Run Code Online (Sandbox Code Playgroud)

css html5 css3 css-transitions

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

Cookie + Zurb Reveal

这个东西还是新的,所以我希望我对这个问题的描述是准确的.

我刚刚插入Zurb Reveal,并在页面加载时工作

$(document).ready(function (){
    $('#myModal').reveal();
});
Run Code Online (Sandbox Code Playgroud)

现在我如何让cookie运行,以便每个用户每天只显示一次?我不希望每次用户导航到主页时都会发生此弹出窗口.

任何帮助,将不胜感激!

cookies jquery zurb-foundation

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

CMB2可重复组显示

我正在使用Custom Metaboxes 2,我无法在前端显示可重复的组值.我有一个可重复的组,只有一个文本字段.

我用这个作为指导.

我首先使用后端代码,然后是前端代码.

add_action( 'cmb2_init', 'awc_register_repeatable_group_field_metabox' );

function awc_register_repeatable_group_field_metabox() {

    // Start with an underscore to hide fields from custom fields list
    $prefix = '_awc_';

/**
 * Repeatable Field Groups
 */
$cmb_group = new_cmb2_box( array(
    'id'           => $prefix . 'songs',
    'title'        => __( 'Track Listing', 'cmb2' ),
    'object_types' => array( 'awc_discography', ),
) );

// $group_field_id is the field id string, so in this case: $prefix . 'demo'
    $group_field_id = $cmb_group->add_field( array(
    'id'          => $prefix . 'demo', …
Run Code Online (Sandbox Code Playgroud)

php wordpress

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