Implement this java-script in joomla 3 (Uncaught TypeError: undefined is not a function (anonymous function)
Implement this java-script in joomla 3 (Uncaught TypeError: undefined is not a function (anonymous function)
我在 Whosebug 上找到了这段很棒的代码,这可能是我搜索了很长时间的解决方案,但我无法在我的 joomla 3 上找到它 运行。
Java-Script:
$('#showVideo').click(function() {
$('#video').show().html('<iframe src="http://player.vimeo.com/video/48459576?title=0&byline=0&portrait=0&color=d01e2f&autoplay=1" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>');
$('#showVideo').hide().html;})
见http://jsfiddle.net/1tszLnhx/2/
在 header 中加载脚本之后 jquery 当我点击实际的 "Click to start Video"-Link:
Uncaught TypeError: undefined is not a function (anonymous function)
我做错了什么?有人可以帮我解决这个问题吗?
首先尝试将上面代码段中的 $
替换为 jQuery
。
通常,在您网站的 fiddle 代码的实际实施中,尝试更具体地说明元素的选择器,例如类名和 ID。
将它包裹在
周围
jQuery( document ).ready(function() { //the above snippet here});
并更改部分
jQuery('img').attr('data-video')
到这个
jQuery('#yourimageid').attr('data-video')
我在 Whosebug 上找到了这段很棒的代码,这可能是我搜索了很长时间的解决方案,但我无法在我的 joomla 3 上找到它 运行。
Java-Script:
$('#showVideo').click(function() {
$('#video').show().html('<iframe src="http://player.vimeo.com/video/48459576?title=0&byline=0&portrait=0&color=d01e2f&autoplay=1" width="400" height="225" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>');
$('#showVideo').hide().html;})
见http://jsfiddle.net/1tszLnhx/2/
在 header 中加载脚本之后 jquery 当我点击实际的 "Click to start Video"-Link:
Uncaught TypeError: undefined is not a function (anonymous function)
我做错了什么?有人可以帮我解决这个问题吗?
首先尝试将上面代码段中的 $
替换为 jQuery
。
通常,在您网站的 fiddle 代码的实际实施中,尝试更具体地说明元素的选择器,例如类名和 ID。
将它包裹在
周围
jQuery( document ).ready(function() { //the above snippet here});
并更改部分
jQuery('img').attr('data-video')
到这个jQuery('#yourimageid').attr('data-video')