views:

422

answers:

1

Hi, I'm building a site that relies heavily on jquery. I have three scripts I'm trying to use on the same page: a lavalamp-style menu, an area with draggable divs, and a content slider containing both elements that will allow me to scroll between content areas.

I can not get the content slider to function correctly. Links will take me to the other content areas, but the "sliding" effect doesn't function correctly unless I get rid of the lava lamp code. Is there some way I can tweak the javascript so that these three scripts can work together?

$(document).ready(function() {

$('a.panel').click(function () {

    $('a.panel').removeClass('selected');
    $(this).addClass('selected');

    current = $(this);

    $('#scroll-wrapper').scrollTo($(this).attr('href'), 800);       

    return false;
});

$(window).resize(function () {
    resizePanel();
});

});

function resizePanel() {
width = $(window).width();
height = $(window).height();

mask_width = width * $('.item').length;

$('#debug').html(width  + ' ' + height + ' ' + mask_width);

$('#scroll-wrapper, .item').css({width: width, height: height});
$('#mask').css({width: mask_width, height: height});
$('#scroll-wrapper').scrollTo($('a.selected').attr('href'), 0);

}


    $(function() {
        $("#3").lavaLamp({
            fx: "backout", 
            speed: 700,
            click: function(event, menuItem) {
                return false;
            }
        });
        $("#dragset div").draggable({ stack: { group: '#dragset div', min: 1 } });
    });
A: 

Geez, I studied the code but couldn't find anything that could cause an issue between the lava lamp and the content slider.

My suggestions:

  1. Check your CSS for the LavaLamp, maybe it is affecting the size of the items, and therefore the scroll is not moving correctly.
  2. Try getting it to work with a vertical/horizontal moving first, since it will be easier to debug.
  3. Do some more debugging, to make sure that the incompatible ones are the lavaLamp and the Content Slider.
  4. Take the resizePanel code out (for now), make sure all components work fine on their own, they do some mix and match.
UberNeet
Thanks for the tips... I tried removing LavaLamp formatting and removing resizePanel code, but in both cases the slider did not work. I'm working on debugging now and will post any updates/results here.
luke
Chrome Dev Tools brings up "Uncaught TypeError: Object #<an Object> has no method 'draggable'"...It then points me to the area above the LavaLamp function. Not sure what to do with that, but I'll keep posting updates.
luke
It seems to me that you are missing a semicolon, or a bracket. I think is best if you start over again, and go step by step. First try getting the content slider to work, with just empty divs, then try getting the draggable divs and the content slider working, together, and finally add the lava lamp. If you could post your HTML code it would be great, so I can understand, how you are adding the three elements together.
UberNeet