简体   繁体   English

FancyBox插件不起作用

[英]FancyBox plugin doesn't work

I have a problem with my fancy box. 我的化妆盒有问题。 when I click on a link, the fancy box gets the content but doesn't show the lightbox and jumps to a page that I supposed to get its returned content via Ajax. 当我单击链接时,精美的框会显示内容,但不会显示灯箱,而是会跳转到我应该通过Ajax获取其返回内容的页面。

HTML : HTML:

<a class="butt red medium fancybox" href="http://localhost/food/index.php/food/ajaxExtras?foodId=412">سفارش </a>

JS : JS:

$("a.fancybox").fancybox();

My Result : 我的结果: 在此处输入图片说明

from your shapshots, i can say that you havnt added the plugin files for fancy box . 从您的照片中,我可以说您没有为花哨的盒子添加插件文件。

here are the links for jquery fancy box plugins.just add them in between your header tags 这是jQuery fancy box plugins的链接。只需在标题标签之间添加它们

http://code.jquery.com/jquery-1.10.2.min.js http://code.jquery.com/jquery-1.10.2.min.js

js/fancybox-1.3.4/jquery.easing-1.3.pack.js js / fancybox-1.3.4 / jquery.easing-1.3.pack.js

js/fancybox-1.3.4/jquery.mousewheel-3.0.4.pack.js js / fancybox-1.3.4 / jquery.mousewheel-3.0.4.pack.js

kindly see the demo in http://fancybox.net/ for further info 请查看http://fancybox.net/中的演示以获取更多信息

If you are opening an external page you may need to set the type of content , either using an API option like 如果您要打开外部页面,则可能需要使用以下API选项设置content type

$("a.fancybox").fancybox({
    type: "ajax" // or "iframe"
});

or using the HTML5 data-fancybox-type attribute in your link like 或在链接中使用HTML5 data-fancybox-type属性,例如

<a data-fancybox-type="ajax" class="butt red medium fancybox" href="http://localhost/food/index.php/food/ajaxExtras?foodId=412">سفارش </a>

Please notice that most ajax calls require to be tested in a server environment and may not work in localhost. 请注意,大多数ajax调用都需要在服务器环境中进行测试,并且可能无法在localhost中运行。

Also make sure you are wrapping your fancybox script code inside the .ready() method. 还要确保将fancybox脚本代码包装在.ready()方法中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM