问题
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