-1

I'm trying to make a new design for a friend's Summer Cart system. The system usually has appearing/disappearing subcategory menus, but then I downloaded a javascript plugin called "lightbox" that shows an image in the current window while it keeps the page, instead of opening up a new window where to show the image. Now the problem is that this "lightbox" plugin has a file called "prototype.js" which causes the subcategories not to work...

Prototype.js: http://www.mediafire.com/?sj3xzdw2gchmca0

The code that makes the submenus appear/disappear:

$(function () {
var stepOver = 20; // The number of pixels of the upper box that are going to cover its parent.
    $("#DropdownCategories ul li").hover(
    function () {
        var firstUls = $(this).find('ul:first');
        firstUls.show();    
                var positionLeft = $(this).position().left - stepOver + $(this).outerWidth();
        var offsetLeft = $(this).offset().left - stepOver + $(this).outerWidth();   
    // Find the position that the box is going to end in.
        var wouldEnd = offsetLeft + firstUls.outerWidth();
                    // If the box ends out of the body we move the box on the left side.
        if (wouldEnd > $('body').innerWidth()) {
            positionLeft = $(this).position().left - firstUls.outerWidth() + stepOver;
        }
                    firstUls.css('position', 'absolute')
            .css('top', $(this).position().top + 'px')
            .css('left', positionLeft + 'px');
    },
    function () {
        $(this).find('ul:first').hide();
    }
);
});

The actual website: http://www.sladurko.com/product/277/bluza-kas-rakav.html

clockworkgeek
  • 37,650
  • 9
  • 89
  • 127
Biser Krustev
  • 443
  • 1
  • 4
  • 6

2 Answers2

1

you're using jQuery, so you'll need to use noConflict

zzzzBov
  • 174,988
  • 54
  • 320
  • 367
  • I tried putting jQuery.noConflict(); right above the code I posted above but it didn't solve anything :S – Biser Krustev Feb 02 '12 at 21:30
  • @BiserKrustev, because you're continuing to misuse `$`. Take the time to read through the page that I linked to and change your code. – zzzzBov Feb 02 '12 at 21:55
1

Since you already use jQuery then choose a jQuery compatible lightbox plugin instead. Adding a whole separate library like Prototype is overkill for a simple task so avoid it. If you were already using Prototype then I would suggest avoid adding jQuery for the same reasons.

clockworkgeek
  • 37,650
  • 9
  • 89
  • 127