Page 1 of 1

[SOLVED] Javascript conflict between Showtime and Gallery

Posted: Thu Jul 09, 2015 7:35 am
by CMSmonkey
Hi everyone,
I have a webpage running 2 different scripts. When I added the Gallery module to the page, the Showtime module stopped working.

Below are the scripts. Is there any way to easily alter the code so that they don't conflict?

SHOWTIME MODULE

Code: Select all

<__script__ type="text/javascript">
        
        $(document).ready(function(){
			var lastslide=0;
			$('ul#slides_7').cycle({ 
				fx: 'curtainX',
				speed:    1000, 
				timeout:  5000,
 
				pagerEvent: 'mouseover',
		
				fastOnEvent: false,
				pause: 1,
				pauseOnPagerHover: 1,
				prev: '#prev_7',
				next: '#next_7' 
			});

            $("#slideshow_7").hover(function() {
                $("ul#prevnextnav_7").fadeIn();
            },
                function() {
                $("ul#prevnextnav_7").fadeOut();
            });
           
                });

        
        </__script>
GALLERY MODULE

Code: Select all

<__script__ type="text/javascript">
  $(function() {
    var galleries = $('.ae-gallery').aeGallery({
      loader_image: 'modules/Gallery/templates/ae-gallery/loader.gif',
      slideshow: {
        autostart: false,
        speed: 4000,
        start_label: 'Start',
        stop_label: 'Stop',
        stop_on_scroll: false
      }
    });
  });
</__script>
Thank you in advance for your help!

Re: Javascript conflict between Showtime and Gallery modules

Posted: Thu Jul 09, 2015 7:56 am
by velden
You probably have these problems because both modules load a jQuery library.

I usually prefer to include a jQuery library myself in the <head> of the page template(s) and don't allow the modules to include it. (Don't know about Showtime).

Re: Javascript conflict between Showtime and Gallery modules

Posted: Thu Jul 09, 2015 8:24 am
by CMSmonkey
Thanks for the response. How can I resolve this? I am not too versed in javascript.

I looked into the page source and this is in the head tag:

Code: Select all

<!--LOAD SHOWTIME jQuery-->
<__script__ type="text/javascript" src="http://www.mysite.com/modules/Showtime/templates/jquery/jquery-1.4.2.js" ></__script>
<__script__ type="text/javascript" src="http://www.mysite.com/modules/Showtime/templates/jquery/jquery.cycle.all.min.js" ></__script>
<!--END SHOWTIME-->
<!-- Gallery/AE-Gallery -->
<link rel="stylesheet" href="http://www.mysite.com/modules/Gallery/templates/css/AE_Gallery.css" type="text/css" media="screen" />
<__script__ type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></__script>
<__script__ type="text/javascript" src="modules/Gallery/templates/ae-gallery/jquery.ae-gallery.min.js"></__script>

<__script__ type="text/javascript">
  $(function() {
    var galleries = $('.ae-gallery').aeGallery({
      loader_image: 'modules/Gallery/templates/ae-gallery/loader.gif',
      slideshow: {
        autostart: false,
        speed: 4000,
        start_label: 'Start',
        stop_label: 'Stop',
        stop_on_scroll: false
      }
    });
  });
</__script>
The Showtime script below is within the body:

Code: Select all

   <__script__ type="text/javascript">
        
        $(document).ready(function(){
			var lastslide=0;
			$('ul#slides_7').cycle({ 
				fx: 'curtainX',
				speed:    1000, 
				timeout:  5000,
 
				pagerEvent: 'mouseover',
		
				fastOnEvent: false,
				pause: 1,
				pauseOnPagerHover: 1,
				prev: '#prev_7',
				next: '#next_7' 
			});

            $("#slideshow_7").hover(function() {
                $("ul#prevnextnav_7").fadeIn();
            },
                function() {
                $("ul#prevnextnav_7").fadeOut();
            });
           
                });

        
        </__script>

Re: Javascript conflict between Showtime and Gallery modules

Posted: Thu Jul 09, 2015 12:47 pm
by staartmees
This problem has already been solved in this forum. In the Showtime module I changed the javascript template, in my case Slimbox, by disabeling jquery.min.js

Code: Select all

<!-- <__script__ type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></__script> -->
<__script__ type="text/javascript" src="modules/Gallery/templates/slimbox/js/slimbox2.js"></__script>

Re: Javascript conflict between Showtime and Gallery modules

Posted: Thu Jul 09, 2015 3:13 pm
by CMSmonkey
staartmees wrote:This problem has already been solved in this forum. In the Showtime module I changed the javascript template, in my case Slimbox, by disabeling jquery.min.js

Code: Select all

<!-- <__script__ type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></__script> -->
<__script__ type="text/javascript" src="modules/Gallery/templates/slimbox/js/slimbox2.js"></__script>
Hi Staartmees,
I saw some threads on this issue that didn't help; this solution I must have overlooked. Thanks so much for your help.