Fancybox box isn't working after I upload it to webhost but works on localhost

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 03:10:29

问题


http://www.outofthegardendesigns.com

any thoughts?

I think it has something to do with the pathing but I'm not sure what I'm doing wrong.


回答1:


You are adding jQuery multiple times.

Two times from this url js/libs/jquery-1.7.1.js and then again with google cdn and again a fallback if google cdn is offline. I guess, this is causing conflict. Since, on your localhost you may be offline, google cdn jQuery is not loading and everything is working fine. But when you open it in server, google cdn jQuery tries to load and takes time and throws an error.




回答2:


Your links to fancybox and jquery is not correct. You have :

<script src="js/libs/jquery-1.7.1.js" type="text/javascript"></script>
<script src="fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script>

You need to add "/" at the begining of the links like:

<script src="/js/libs/jquery-1.7.1.js" type="text/javascript"></script>
<script src="/fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script>

After removing extra jquyer link, your code should be look like this:

<script src="/js/libs/jquery-1.7.1.js" type="text/javascript"></script>
<script type="text/javascript">

    $(document).ready(function(){

        $('.b2').animate({
            opacity:.0

        });

        $('.b2').hover(function(){
            $(this).stop().animate({opacity:1});


        }, function(){
            $(this).stop().animate({opacity:0});

        });


    });
</script>


<!--FANCY BOX-->
<script src="/fancybox/jquery.fancybox-1.3.4.pack.js" type="text/javascript"></script>


来源:https://stackoverflow.com/questions/10052848/fancybox-box-isnt-working-after-i-upload-it-to-webhost-but-works-on-localhost

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!