Magnific-popup不支持动态加载的内容 [英] Magnific-popup is not working with dynamically loaded content
本文介绍了Magnific-popup不支持动态加载的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我通过ajax调用动态加载了以下HTML。
I have loaded the below HTML dynamically through ajax call.
<div class="item-wrap"><a href="http://myfourwalls.in/project_details/hoysala_ace_2/floor_plans/101_blockd.jpg" title=""><div id="hotspot-32" class="hs-wrap hs-loading"><img src="http://myfourwalls.in/project_details/hoysala_ace_2/floor_plans/101_blockd.jpg"><div class="hs-spot-object" data-type="spot" data-x="355" data-y="436" data-width="30" data-height="30" data-popup-position="left" data-visible="visible" data-tooltip-width="150" data-tooltip-auto-width="false"></div><div class="hs-spot-object" data-type="spot" data-x="466" data-y="781" data-width="30" data-height="30" data-popup-position="left" data-visible="visible" data-tooltip-width="200" data-tooltip-auto-width="true"></div><div class="hs-spot-object" data-type="spot" data-x="1010" data-y="490" data-width="30" data-height="30" data-popup-position="left" data-visible="visible" data-tooltip-width="200" data-tooltip-auto-width="true"></div></div><div style="padding:0px;text-align:center;list-style: none;"><ul><li class="grey">Area :1685 sq.ft</li><li class="grey">Pricing : 6000/Sq.ft</li><li class="grey">Facing : North</li><li class="grey">Balcony : 1</li></ul><!--<div class="overlay"--></div><div class="link-icon"><i class="icon-plus"></i></div></a></div>
我有以下脚本用于放大弹出窗口。
I have the following script for magnific popup.
$('.item-wrap a').magnificPopup({
type:'ajax',
fixedContentPos: false,
removalDelay: 200,
showCloseBtn: false,
mainClass: 'mfp-fade'
});
但它无效。它在控制台中显示一个错误
But it is not working.It is showing one error in the console
Uncaught TypeError: $ is not a function
在
jquery.magnific-popup.js:50
如何解决这个问题?我无法找到这段代码的错误?
How can I solve this?I cant find whats wrong with this code?
推荐答案
(' .stem-wrap a')。magnificPopup({
type:' ajax',
fixedContentPos: false ,
removalDelay: 200 ,
showCloseBtn: false ,
mainClass :' mfp-fade'
});
('.item-wrap a').magnificPopup({ type:'ajax', fixedContentPos: false, removalDelay: 200, showCloseBtn: false, mainClass: 'mfp-fade' });
但它无效。它在控制台中显示一个错误
But it is not working.It is showing one error in the console
Uncaught TypeError:
不是函数
jquery.magnific-popup.js:50
如何解决这个问题?我无法找到这段代码的错误?
How can I solve this?I cant find whats wrong with this code?
确保在调用magnific popup之前加载了jquery.js.
Hi,
Make sure jquery.js is loaded before the magnific popup is called.
这篇关于Magnific-popup不支持动态加载的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文