Fancybox无法正常工作 [英] Fancybox not working

查看:76
本文介绍了Fancybox无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在fancybox中解决此问题?

How fix this problem in fancybox?

Uncaught TypeError: Object #<Object> has no method 'fancybox' localhost/:74
(anonymous function) http://localhost/:74
o.extend.ready.o.readyList jquery.min.js:19
o.extend.each jquery.min.js:12
o.extend.ready jquery.min.js:19
o.each.o.fn.(anonymous function)

这是header.php中的代码,我不知道哪里可能有问题!我尝试使用simplemodal,但无法正常工作! Tabslider可能有问题!我制作了在fancybox网站上写的所有内容.

Here is code in header.php I dont know where can be problem! I try use simplemodal but is not working! Maybe is problem with tabslider! I make everything that is write on fancybox website.

<link rel="stylesheet" href="css/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
<script type="text/javascript" src="js/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
    <script type="text/javascript">
        $(function(){
            $('.slide-out-div').tabSlideOut({
                tabHandle: '.handle',
                pathToTabImage: 'img/handle-bg.png',
                imageHeight: '186px',
                imageWidth: '30px',
                tabLocation: 'left',
                speed: 300,
                action: 'click',
                topPos: '150px',
                leftPos: '20px',
                fixedPosition: false
            });
    });
    </script>
    <script type="text/javascript">
        $(function(){
            $('.add_site_right').tabSlideOut({
                tabHandle: '.handle_right',
                pathToTabImage: 'img/handle-bg.png',
                imageHeight: '186px',
                imageWidth: '30px',
                tabLocation: 'right',
                speed: 300,
                action: 'click',
                topPos: '150px',
                leftPos: '20px',
                fixedPosition: false
            });
    });
    </script>
    <script type="text/javascript">
            $(document).ready(function() {
                /*
                *   Examples - images
                */

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

                $("a#example2").fancybox({
                    'overlayShow'   : false,
                    'transitionIn'  : 'elastic',
                    'transitionOut' : 'elastic'
                });

                $("a#example3").fancybox({
                    'transitionIn'  : 'none',
                    'transitionOut' : 'none'    
                });

                $("a#example4").fancybox({
                    'opacity'       : true,
                    'overlayShow'   : false,
                    'transitionIn'  : 'elastic',
                    'transitionOut' : 'none'
                });

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

                $("a#example6").fancybox({
                    'titlePosition'     : 'outside',
                    'overlayColor'      : '#000',
                    'overlayOpacity'    : 0.9
                });

                $("a#example7").fancybox({
                    'titlePosition' : 'inside'
                });

                $("a#example8").fancybox({
                    'titlePosition' : 'over'
                });

                $("a[rel=example_group]").fancybox({
                    'transitionIn'      : 'none',
                    'transitionOut'     : 'none',
                    'titlePosition'     : 'over',
                    'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
                        return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
                    }
                });

                /*
                *   Examples - various
                */

                $("#various1").fancybox({
                    'titlePosition'     : 'inside',
                    'transitionIn'      : 'none',
                    'transitionOut'     : 'none'
                });

                $("#various2").fancybox();

                $("#various3").fancybox({
                    'width'             : '75%',
                    'height'            : '75%',
                    'autoScale'         : false,
                    'transitionIn'      : 'none',
                    'transitionOut'     : 'none',
                    'type'              : 'iframe'
                });

                $("#various4").fancybox({
                    'padding'           : 0,
                    'autoScale'         : false,
                    'transitionIn'      : 'none',
                    'transitionOut'     : 'none'
                });
            });
        </script>

推荐答案

您的网站adzire.com抛出javascript错误,从而使您的某些脚本(包括fancybox)失败.您需要稍微修改一下代码:

Your site adzire.com throws javascript errors so that is making some of your scripts (including fancybox) to fail. You need to tide up your code a bit:

首先,您只需要一个jQuery实例(最好是最新版本),到目前为止,您有3个(1.4、1.6.2和1.7.2).我猜您应该删除v1.4和1.6.2(某些插件包含复制的jQuery,但这并不意味着您需要全部.)还要确保在加载其他任何脚本或jQuery插件之前先加载jQuery.

First, you only need a single instance of jQuery (ideally the latest version), so far you have 3 (1.4, 1.6.2 and 1.7.2). I guess you should remove v1.4 and 1.6.2 (some plugins include a copy jQuery but it doesn't mean you need them all.) Also make sure that load jQuery before any other script or jQuery plugin.

第二,与jQuery一样,您只需要一个jQuery插件的单个实例.您要加载jQuery UI 1.8.21两次...请删除其中一个.我猜是因为您在使用不同版本的jQuery之后加载了它们中的每一个,所以会产生以下错误:

Second, same as jQuery, you only need a single instance of any of your jQuery plugins. You are loading jQuery UI 1.8.21 twice ... remove one. I guess because you load each of them after a different version of jQuery, it creates these erros:

Timestamp: 22/06/2012 11:35:54 AM
Error: $(".cont .wrapper .block select.styled").select_skin is not a function
Source File: http://www.adzire.com/js/main.js
Line: 6

Timestamp: 22/06/2012 11:36:03 AM
Error: detailsBox is not defined
Source File: http://www.adzire.com/
Line: 115

进行一些清理可能会解决您的问题,包括fancybox问题.

A bit of clean up might fix your issues, including fancybox issue.

这篇关于Fancybox无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆