Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2010
    Location
    Sutton-in-ashfield, Notts
    Posts
    117
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Does anyone know how to help me with this?

    Anyone got any idea why this won't work, fairly new to jQuery.
    Using jquery 1.4.4 min.

    Code:
    $( document ).ready( function() {
    
    	nav_num = 0;
    	$$( "div.big-icons > div:not(.link)" ).each( function( element ) {
    		nav_num++;
    		if( !element.id ) {
    			element.id = "nav-" + nav_num;
    		}
    		if( element.className != "link" ) {
    			var childElement = element.childNodes[3];
    			if( !childElement.id ) {
    				childElement.id = "sub-nav-" + nav_num;
    			}
    			$( element ).observe( 'mouseover', function( event ) {
    				$$( "div.big-icons > div:not(.link) div.sub-nav" ).each( function( element2 ) {
    					if( element2.id != childElement.id ) {
    						element2.hide();;
    					}
    				} );
    				$$( "div.big-icons > div:not(.link)" ).each( function( element2 ) {
    					if( childElement.id == element2.childNodes[3].id ) {
    						element2.childNodes[1].addClassName( 'selected' );
    					} else {
    						element2.childNodes[1].removeClassName( 'selected' );
    					}
    				} );
    				var relatedTarget = $( event.relatedTarget || event.fromElement );
    				var target = Event.element( event );
    				if( ( target == element || Element.descendantOf( target, element ) ) && !( ( relatedTarget == element ) || Element.descendantOf( relatedTarget, element ) ) ) {
    					childElement.show();
    					Event.observe( window, 'blur', function () {
    						childElement.hide();
    						Event.stopObserving( window, 'blur' );
    					} );
    				}
    			} );
    			$( element ).observe( 'mouseout', function( event ) {
    				var relatedTarget = $( event.relatedTarget || event.fromElement );
    				var target = Event.element( event );
    				if( ( target == element || Element.descendantOf( target, element ) ) && !( ( relatedTarget == element ) || Element.descendantOf( relatedTarget, element ) ) ) {
    					childElement.style.display = "none";
    					Event.stopObserving( window, 'blur' );
    					$$( "div.big-icons > div:not(.link)" ).each( function( element2 ) {
    						element2.childNodes[1].removeClassName( 'selected' );
    					} );
    				}
    			} );
    			document.observe( 'mouseout', function( e ) {
    				e = e ? e : window.event;
    				var from = e.relatedTarget || e.toElement;
    				if( !from || from.nodeName == "HTML" ) {
    					$$( "div.big-icons > div:not(.link) div.sub-nav" ).each( function( element2 ) {
    						element2.hide();
    					} );
    					$$( "div.big-icons > div:not(.link)" ).each( function( element2 ) {
    						element2.childNodes[1].removeClassName( 'selected' );
    					} );
    				}
    			} );
    		}
    	} );
    
    } );
    Thanks.

  • #2
    Senior Coder
    Join Date
    Dec 2010
    Posts
    2,396
    Thanks
    12
    Thanked 569 Times in 562 Posts
    This is not jQuery code ... it seems to be coming from using the prototype framework I guess. That's why it doesn't work in the first place.

    If you really want to mix prototype with jQuery in the future, you'd have to use the jQuery.noConflict() method.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •