0

I'm trying to implement scrollorama effect on my horizontal webpage sliding, but when I trying to call it, my menu doesn't work and the navigation arrows neither. Plus the scrollorama doesn't work too. here is my fiddle : http://jsfiddle.net/jarod51/Tm9fs/

here my jquery :

$(document).ready(function() {      
        var scrollorama = $.scrollorama({ blocks:'.panel' });


    scrollorama.animate('#contact h2',{
        duration:200, property:'left', end:-860
    });

});


    $(function () {
        var 
            animation = function ( href ) {
                var 
                    name = "active",
                    element = $( "a[href='" + href + "']" );

                $( "html, body" ).stop().animate( {
                    scrollLeft: $( href ).offset().left
                }, 1200 );

                element.closest( "ul" ).find( "li" ).removeClass( name );
                element.parent().addClass( name );
            },
            menu = $( "#list" );

        animation( menu.find( "li" ).eq( 0 ).find( "> a" ).attr( "href" ) );

        $( "#cssmenu a" ).bind( "click", function( event ) {
            var target = $( this ).attr("href");

            animation( target );

            event.preventDefault();
        } );

        $( "#next, #prev" ).click( function ( event ) {
            var
                positionActiveClass = menu.find( "> li.active" ).index(),
                menuLength = menu.find( "> li" ).length - 1,
                buttonId = $( this ).attr( "id" );

            if ( buttonId === "next" ) {
                if ( positionActiveClass === ( menuLength ) ) {
                    newElementActiveClass = menu.find( "li" ).eq( 0 );
                    newPositionActiveClass = newElementActiveClass.find( "> a" ).attr( "href" );

                    animation( newPositionActiveClass );
                } else {
                    newElementActiveClass = menu.find( "li" ).eq( positionActiveClass + 1 );
                    newPositionActiveClass = newElementActiveClass.find( "> a" ).attr( "href" );

                    animation( newPositionActiveClass );
                }
            } else {
                if ( positionActiveClass === 0 ) {
                    newElementActiveClass = menu.find( "li" ).eq( menuLength );
                    newPositionActiveClass = newElementActiveClass.find( "> a" ).attr( "href" );

                    animation( newPositionActiveClass );
                } else {
                    newElementActiveClass = menu.find( "li" ).eq( positionActiveClass - 1 );
                    newPositionActiveClass = newElementActiveClass.find( "> a" ).attr( "href" );

                    animation( newPositionActiveClass );
                }
            }

            event.preventDefault();
        } );

    } );

Do you know what I'm doing wrong ?

user979974
  • 883
  • 3
  • 13
  • 32

0 Answers0