我很难找到哪个jQuery插件或Wordpress中的其他插件不允许使用fancybox加载iframe。
Easy Fancybox与剥离的html作品,下面是工作版本
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head>
<!-- Add jQuery library -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<link rel='stylesheet' id='easy-fancybox.css-css' href='http://www.wp-responsive-themes.com/wp-content/plugins/easy-fancybox/easy-fancybox.css.php?ver=1.3.4' type='text/css' media='screen' />
<script type='text/javascript' src='http://www.wp-responsive-themes.com/wp-content/plugins/easy-fancybox/fancybox/jquery.fancybox-1.3.4.pack.js?ver=1.3.4'></script>
</head>
<body>
<a href="http://wp-responsive-themes.com/" data-fancybox-type="iframe" title="preview" class="preview fancybox-iframe">Preview</a>
<script type="text/javascript">
jQuery(document).ready(function() {
$("a.preview").fancybox({
'Width' : 960 ,
'Height' : 640,
'hideOnContentClick': false,
'type':'iframe'
});
});
</script>
</body>
</html>但是fancybox不能在页面上加载iframe (Wordpress)。
单击下一页中的"iPhone 5垂直方向预览“时,应打开iframe
http://www.wp-responsive-themes.com/2012/myapp-adaptive-wp-theme-for-app-developers-429/
需要帮助
亲切的问候
发布于 2012-09-17 00:38:51
Wordpress的设置方式是使用jQuery而不会发生冲突。这意味着$不是现成的。
http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers
jQuery(document).ready(function($) {
$("a.iphone4_vertical").fancybox({
'Width' : 960 ,
'Height' : 640,
'hideOnContentClick': false,
'type':'iframe'
});
});将$作为函数参数添加应该可以解决您的问题。
https://stackoverflow.com/questions/12448151
复制相似问题