开发者

Why won't this jQuery include work?

I have a modal window from which I am calling a lighbox to view images. I have got the lightbox to work on it's own, but cannot get it working from the modal window.

If i include jQuery before the lightbox includes - the page breaks and all styling of the portlet fails.

Any help greatly appreciated, Rich.

Project: http://djrb.co.uk/lightbox/tester.html

Working example of lightbox: http://djrb.co.uk/lightbox/working_exa开发者_运维问答mple.html


Looks like you are including both jQuery and Prototype. Since they both redefine the $ you need to do special handling and have the following line after jQuery is loaded

  jQuery.noConflict();

See this link for more details.


You have other JS libraries already included. These libraries are accessed via $, the same way jquery is. If you have to use mutiple libraries use jquery no conflict mode.

<html>
 <head>
   <script src="prototype.js"></script>
   <script src="jquery.js"></script>
   <script>
     jQuery.noConflict();

     // Use jQuery via jQuery(...)
     jQuery(document).ready(function(){
       jQuery("div").hide();
     });

     // Use Prototype with $(...), etc.
     $('someid').hide();
   </script>
 </head>
 <body></body>
 </html>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜