wordpress多次点击功能

时间:2015-05-06 19:52:58

标签: javascript php jquery

我想在WordPress的页面中使用动态内容;我想在YouTube视频的文本之间切换。这两个函数分别工作正常,但我不能让它们都工作

文字功能(switchcontent.js)



jQuery(document).ready(function($) {
    $("a").click(function(){
        $('#tekst').text( $(this).attr('data-name'));
    });
});




YouTube功能(video.js)



jQuery(document).ready(function($){
	$('.vid_button').click( function(e){
		e.preventDefault();
		var URL = $(this).attr('href');
		//var htm = '[embed]https://youtu.be/' + URL + '[/embed]';
		var htm = '<iframe width="560" height="315" src="http://www.youtube.com/embed/' + URL + '?wmode=transparent&rel=0&theme=dark&color=red&autoplay=1" frameborder="0" allowfullscreen ></iframe>';
		$('.video_position_size').html(htm);
		return false;
	});
});
&#13;
&#13;
&#13;

Function.php

&#13;
&#13;
add_action( 'wp_enqueue_scripts', 'add_my_script' );
function add_my_script() {
	wp_enqueue_script(
        'your-script', // name your script so that you can attach other scripts and de-register, etc.
        get_template_directory_uri() . '/js/custom/video.js', // this is the location of your script file
        array('jquery') // this array lists the scripts upon which your script depends
    );
    wp_enqueue_script(
        'your-script', // name your script so that you can attach other scripts and de-register, etc.
        get_template_directory_uri() . '/js/custom/switchcontent.js', // this is the location of your script file
        array('jquery') // this array lists the scripts upon which your script depends
    );
}
&#13;
&#13;
&#13;

0 个答案:

没有答案