[jQuery] IE Problem with (function($)

2009-01-13 Thread Aryan

I have a problem with Internet Explorer ( all versions ) . The
following is my JQuery Code , which executes perfectly in mozilla and
chrome.. But it doesn't work in Internet Explorer.
It says : Syntax error ( line 1 )... Can anyone help me out here..
Thanks for your time in reading this.


(function($){
var EYE = window.EYE = function() {
var _registered = {
init: []
};
return {
init: function() {
$.each(_registered.init, function(nr, fn){
fn.call();
});
},
extend: function(prop) {
for (var i in prop) {
if (prop[i] != undefined) {
this[i] = prop[i];
}
}
},
register: function(fn, type) {
if (!_registered[type]) {
_registered[type] = [];
}
_registered[type].push(fn);
}
};
}();
$(EYE.init);
})(jQuery);


[jQuery] Navigation with active state

2008-12-18 Thread aryan

I have a navigation like this

div id=mainnav
ul id=nav
li class=suba href=a.htmlb class=img src=img1-off.gif
alt=About GTx //b/a
ul
lia href=a.htmlnav1 /a/li
lia href=b.htmlnav2 /a/li
lia href=c.htmlnav3 /a/li
/ul
/li
li class=suba href=d.htmlb class=img src=img2-off.gif
alt=About GTx //b/a
ul
lia href=d.htmlnav4 /a/li
lia href=e.htmlnav5 /a/li
lia href=f.htmlnav6 /a/li
/ul
/li
/ul
/div

I want the image get replaced with its on state version (img2-off.gif
or img2-off.gif) if you are on it's page or it's child page.

How to do this using jquery.

Thanks!