• Hi,
    I have created a website at https://www.cressidajade.com/photographs/ for a friend and I used a carousel that worked and then for some strange reason didnt work. The code is as follows:

    Theses are the includes:

    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/assets/js/sifr.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/assets/js/sifr-config.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/assets/js/reflex.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/assets/js/mootools.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/assets/js/mediabox72.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/assets/js/swfobject.js"></script>
    <script src="<?php bloginfo('template_directory'); ?>/assets/js/lib/prototype.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/assets/js/lib/effects.js" type="text/javascript"></script>
    <script src="<?php bloginfo('template_directory'); ?>/assets/js/dist/carousel.js" type="text/javascript"></script>

    HTML Code:

    <div id="horizontal_carousel">
      <div class="previous_button"></div>
        <div class="container">
           <ul>
            <li>...</li>
         </ul>
         </div>
          <div class="next_button"></div>
        </div>
    <script type="text/javascript">
    // <![CDATA[
      function runTest() {
        hCarousel = new UI.Carousel("horizontal_carousel");
      }
      Event.observe(window, "load", runTest);
    // ]]>
    </script>

    CSS Styling:

    /* ----------------------------------- */
    /*      4. HORIZONTAL CAROUSEL         */
    /* ----------------------------------- */
    .container {
     position:relative;
    	overflow:hidden;   /* causes the clipping */
    	visibility:hidden; /* component turns it on when first item is rendered */
    }
    
    #horizontal_carousel {
      float: left;
      width: 850px;
      height: 240px;
      margin-bottom:0 auto;
    }
    
    #horizontal_carousel .container {
      float: left;
      width: 760px;
      height: 550px;
      overflow: hidden;
    }
    
    #horizontal_carousel ul {
      margin: 0;
      padding:0;
      width: 100000px;
      top: 0;
      left: 0;
      height: 240px;
    }                      
    
    #horizontal_carousel ul li {
      width: 400px;
      height: 550px;
      text-align: center;
      list-style:none;
      float:left;
    }
    
    #horizontal_carousel .previous_button {
      margin:140px 0 0 0;
    		float:left;
      width: 32px;
      height: 32px;
      background: url(assets/images/left.png) no-repeat;
      z-index: 100;
      cursor: pointer;
    }
    
    #horizontal_carousel .previous_button_over {
      background: url(assets/images/left_over.png) no-repeat;
    }
    
    #horizontal_carousel .previous_button_disabled {
      background: url(assets/images/left_disabled.png) no-repeat;
      cursor: default;
    }
    
    #horizontal_carousel .next_button {
      margin:140px 0 0 20px;
    		float:left;
      width: 32px;
      height: 32px;
      background: url(assets/images/right.png) no-repeat;
      z-index: 100;
      cursor: pointer;
    }
    
    #horizontal_carousel .next_button_over {
      background: url(assets/images/right_over.png) no-repeat;
    }
    
    #horizontal_carousel .next_button_disabled {
      background: url(assets/images/right_disabled.png) no-repeat;
      cursor: default;
    }

    It used to work but I can’t remember what I did to make it stop working. I have the following plugins installed which I have disabled one by one and checked:

    BM Custom Login 1.3
    NextGEN FlashViewer 1.2
    NextGEN Gallery 1.0.2
    WordPress Database Backup 2.2.2
    WP-SimpleViewer

    I’m running WordPress 2.7. I have also commented out the javascripts for the sIFR Text replacement but that didn’t work either.

    Could anyone shed some light on the issue please, it has had me stumped for a week now.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter solidariti

    (@solidariti)

    I still haven’t managed to figure this out does anyone know how to solve this?

    Most likely, it is the file named prototype.js

    However, if you deactivate prototype.js, your carousel won’t work. But, the other things that currently don’t work will start working again.

    I am having trouble figuring out how to get Carousel to work without the prototype.js file; else, find an alternative altogether. prototype.js also conflicts with the videobox plugin, by the way!

    Thread Starter solidariti

    (@solidariti)

    Hi WebifiedOne,
    I understand your reasoning. I’ve found it the potential downside to having some plugins. Some developers import via a script tag ‘Javascripts’ that need to be run in isolation. But they don’t check or nor do they just import the scripts needed for their plugin on the page that it is only used on!

    So I found out that my Carousel wasn’t working because I was using NexTGen Gallery Plugin (which is a fantasitc gallery plugin I might add) which conflicted with the Prototype.js I was using only one page – for the very reason I mentioned above.

    Steps I went through to troubleshoot:
    1. Turned off all plugins, to see if it worked, if it does then great you now know that its one of the plugins then it’s a case of turning them on one by one and keep refreshing the page to see if it works.
    1. a) If that doesn’t work like I did, then check your source of your page with both the plugins turned on and the plugins turned off and compare them using a compare tool, or just analyse them yourself if you don’t have a MAC (to use the ‘diff’ command in the terminal) or a piece of software named ‘compareIt’
    1. b) Now you have found which javascript is destroying your plugin, now you need to trace to a file by using a sesarch and replace tool in your development environment or via the terminal with ‘grep’ in MAC (without the quote marks)
    1. c) When you have found it now comment them out and refresh your pages and see if it works. Now it may work but it may also crash some other functionality you have. So now you know which one it is and what it effect, you can move on to the next step.
    1. d) Use a conditional statement like if, or while etc to only display that imported javascript on the page that it only needs it. Now if you require them both to work on the same page then that is a different kettle of you fish, if you’re not proficient in Javascript you will need to:
    I. Ask the developer
    II. Get someone to help you
    II. Try to hack it and find out what is causing them not to work, use the Javscript console for this, that is good, or Firebug for Mozilla (An extension that you can find via google)

    2. Now you should have you’re videobox plugin working and your other plugins working.

    Did this help? If you needd any more help post some code, with a link.

    Solidariti

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Javascript Carousel Issue’ is closed to new replies.