开发者

One of my scripts prevents another to execute

开发者 https://www.devze.com 2023-02-03 00:30 出处:网络
I have jQuery lightbox working on my site, everything w开发者_如何学编程as working fine until I added a js dropdown. Now my drop-down only executes when I remove the lightbox function at the top of th

I have jQuery lightbox working on my site, everything w开发者_如何学编程as working fine until I added a js dropdown. Now my drop-down only executes when I remove the lightbox function at the top of the page. Same thing for the lightbox, it only works when I remove the js include for the drop down.

Here's the page - http://norcalwater.blackdogstaging.com/groundwater-management/ The dropdown is on the 'Water Managment'. Notice the images in the content that should enlarge within lightbox aren't working.

Thanks for the help!


Move scripts around. If you'll put them like that:

<script type="text/javascript" src="/res/js/fancydropdown.js"></script>
<script type="text/javascript" src="/res/js/jquery.lightbox-0.5.js"></script>
<script type="text/javascript">
$(function() {
    $('a.lightbox').lightBox();
});

it will be fine. You're including jQuery library 3 times in <head>

jQuery library here

Line 13:<script type="text/javascript" src="/res/js/jquery.js"></script>

Line 14:<script type="text/javascript" src="/res/js/jquery.lightbox-0.5.js"></script>

jQuery library here

Line 21:<script type='text/javascript' src='http://norcalwater.blackdogstaging.com/wp-includes/js/jquery/jquery.js?ver=1.4.2'></script>

jQuery library here (inside this js file there's a jQuery code and sizzle - part of jQuery library)

Line 40:<script type="text/javascript" src="/res/js/fancydropdown.js"></script>

As the fancydropdown.js have a jQuery library inside it's now loading jQuery 3 times and then scripts, you should clear it up.

Cheers

G.

0

精彩评论

暂无评论...
验证码 换一张
取 消