...

View Full Version : Does anyone know how to help me with this?



Idfk
03-26-2012, 12:24 AM
Anyone got any idea why this won't work, fairly new to jQuery.
Using jquery 1.4.4 min.


$( 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.

devnull69
03-26-2012, 07:33 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum