0

I'm using prototype.js for light box window and jquery.validate.js using for form validation in same window but both the scripts are getting conflicts

i used noconflict function but light box only working form validation is not working

light box script

<script type="text/javascript" src="javascripts/prototype.js"> </script>
<script type="text/javascript" src="javascripts/effects.js"> </script>
<script type="text/javascript" src="javascripts/window.js"> </script>
<script type="text/javascript" src="javascripts/window_effects.js"> </script>
<script type="text/javascript" src="javascripts/debug.js"> </script>

validation sctipt

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.validate.js"></script>
BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
gowri
  • 3,103
  • 2
  • 17
  • 7

3 Answers3

3

If you call jQuery.noConflict(); it would not associate $ with jQuery.

Then you would just use jquery functions as JQuery(element).html() and Prototype with $.

As Nick suggested, there's a lightbox jQuery plugin, which can be found here

If you really need to use both, this answer has some information that might help you.

But it might be best to stick with one library to avoid the hassle.

Community
  • 1
  • 1
1

SOLUTION:

<!--<script type="text/javascript" src="scripts/prototype.js"></script>-->
<!--<script type="text/javascript" src="scripts/lightbox.js"></script>-->       
<script type="text/javascript" src="scripts/mootools.js"></script>
<script type="text/javascript" src="scripts/swfobject.js"></script>
<script type="text/javascript" src="scripts/videobox.js"></script>    
<!--<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.js"></script>-->    
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>   
<script type="text/javascript" src="scripts/jquery.mousewheel-3.0.4.pack.js"></script>
<script type="text/javascript" src="scripts/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="scripts/jquery.fancybox-1.3.4.css" media="screen" />

<script type="text/javascript">
    jQuery.noConflict();
</script>

<script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery('.boxgrid.caption').each(function () {
            jQuery(this).mouseenter (function() {
                jQuery(this).find(".cover").animate({top:'50px'}, {queue:false, duration:160});
            });     
            jQuery(this).mouseleave (function() {
                jQuery(this).find(".cover").animate({top:'150px'}, {queue:false, duration:160});
            });     
        });
        jQuery("a.external").fancybox();
    });
</script>
LPL
  • 16,827
  • 6
  • 51
  • 95
sjames0077
  • 11
  • 1
0

If you put <script src="jquery.js"> (and all the other jQuery stuff) first, then embed the prototype scripts, Prototype will overwrite anything that jQuery defines that conflicts with Prototype (ie. $ will belong to Prototype). Then, Lightbox can use Prototype via the $ variable and you can use jQuery(...) instead of $(...) for jQuery stuff.

Details from jQuery docs

jhartz
  • 1,566
  • 9
  • 12