There is a conflict when trying to use the jquery cycle plugin and lightbox plugin

I am working on a site that has a jquery loop plugin built in. Everything worked fine until I tried to add the lightbox plugin. There seems to be a problem in the element that only allows the latest JS files to work. Any help would be great.

Here is the jquery code that I use in the element.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>

<!-- include Cycle plugin -->
<script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.2.74.js"></script>
<!--  initialize the slideshow when the DOM is ready -->
<script type="text/javascript">
$(document).ready(function () {
    var titles = ['Pentiction Summer Classic', 'Ryan Kesler', 'Trevor Linden'];
    $('.slideshow').after('<div id="navigation"><div id="nav"></div></div>').cycle({
        fx:     'fade', 
        timeout: 5000, 
        pager:  '#nav',
        pagerAnchorBuilder: function (index) {
            return '<a href="#">' + titles[index] + '</a>';
        }
    });
});
</script>

It works without any problems.

Here is the lightbox code in the element.

<script src="js/prototype.js" type="text/javascript"></script>
    <script src="js/scriptaculous.js?load=effects,builder" type="text/javascript"></script>
    <script src="js/lightbox.js" type="text/javascript"></script>

It also works without problems. When I combine them, only the last element works. The first is torn.

I checked the error console and this is the error:

Error: element.dispatchEvent is not a function Source file: http: // localhost: 8888 / rockymountainsports / rms / web / js / prototype.js Line: 3972

, js . ?

+3
1

, , 2 Javascript Frameworks, jQuery Prototype.

, , .

jQuery lightbox jQuery noConflict(). - :

var $j = jQuery.noConflict();

$("someelement") $j("somelement");

- .

+1
source

Source: https://habr.com/ru/post/1768717/


All Articles