Orbit Slider jQuery and Google Adsense

僤鯓⒐⒋嵵緔 提交于 2019-12-25 11:58:19

问题


I'm trying to implement Orbit Slider in my homepage using this code:

<script type="text/javascript" src="resources/js/jquery.js"></script>
<script type="text/javascript" src="resources/js/jquery.simplemodal.js"></script>
<script type="text/javascript" src="resources/js/help_support.js"></script>
<script type="text/javascript" src="resources/js/terms_conditions.js"></script>
<script type="text/javascript" src="resources/js/privacy_policy.js"></script>
<script type="text/javascript" src="resources/js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="resources/js/jquery.orbit-1.2.3.min.js"></script>

<!--[if IE]>
    <style type="text/css">
        .timer { display: none !important; }
        div.caption { background:transparent; filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000,endColorstr=#99000000);zoom: 1; }
    </style>
<![endif]-->

<script type="text/javascript">
    $(window).load(function() {
        $('#featured').orbit();
    });
</script>

This works, but if I add the following code to my page, where I want to show Google Adsense ads, the slider stops loading images in Safari, Chrome and Firefox (for some reason it still works in Opera).

<div>
    <script type="text/javascript">
        <!--
        google_ad_client = ad_client;
        /* homepage_200x200_1 */
        google_ad_slot = ad_slot;
        google_ad_width = 200;
        google_ad_height = 200;
        //-->
    </script>
    <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
</div>

I've found many questions about jQuery conflicts in here and this useful page on the web, but I'm new to javascript and I'm not able to make my actual code work.

Can you please help me fixing my code? Thank you in advance...


回答1:


I had the exact same problem and after doing research I found out that the

$(window).load(function() {

should be

$(function() {

I found the answer here http://www.codingforums.com/showthread.php?t=253841



来源:https://stackoverflow.com/questions/11073241/orbit-slider-jquery-and-google-adsense

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