[jQuery] Re: My code is not working getting an error missing )
Hi, again, Jessie... Just wanted to let you know I haven't given up on you. It's was about midnight here and time for some sleep. Now I'm up again and I'll be able to take a look at your code later today and see if we can figure things out. I'm not the brightest knot on the jQuery log, but I'm persistent, as I can tell you are. I don't code in PHP, (I use ColdFusion) so I'll have trouble understanding that code, but maybe we can figure out a solution. I'll have to get the pngFix code, too. Can you email me directly and attach the images you're using so I can at least try to get the rollover part working? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of jessie Sent: Sunday, October 11, 2009 8:31 AM To: jQuery (English) Subject: [jQuery] Re: My code is not working getting an error missing ) bump* anyone? ;) On Oct 11, 4:43 pm, jessie wrote: > Ok so this is what i want to do and can't achieve. > > I have images that i'd like to rollover here is the markup for both > of those instances, 1 is a button and the other is just a hyperlink > > > > > class="textboxMail" value="{LANG_EMAIL_ADDRESS}" > onclick="this.value='';" /> > > > > > > it was all working fine until i applied the png fix. which is > jquery.pngFix which i downloaded from herehttp://jquery.andreaseberhard.de/pngFix/ > > Now i don't know how to fix this i have tried and tried and can't > understand what i would need to do to make this all work. > > I need to use jquery because i want to keep my alt and title tags > behind my images. > > Here is the code i have. which is not working in IE > > jQuery(function($) { > > function getLeaf(url) { > var splited=url.split('?');// remove all the parameter from url > url=splited[0]; > return url.substring(url.lastIndexOf("/")+1);// return file name} > > jQuery.fn.extend({ > enter: function() {//plugins creation > return this.each(function() { > var pth = $(this).find("img")[0]; > //alert($(this).children().attr("href")); > if($(this).children().attr("href")==getLeaf > (document.location.href)){// check that the link url and document url > > $(pth).attr("src",pth.src.replace(/.png/g, '_active.png')); > } else{ > $(this).hover(function(){ > $(pth).attr("src",pth.src.replace(/.png/ > g,'_active.png'));// mouse over Image > },function(){ > $(pth).attr("src",pth.src.replace(/_active.png/ > g,'.png')); > }); > } > }); > }}); > > $(function(){ // Document is ready > $(".LPButton,.CatMoreBtn").enter();// call the function}); > > $('input[type="image"]').hover( > function () { $(this).attr("src", $(this).attr("src").split('- > off').join('-on')); }, > function () { $(this).attr("src", $(this).attr("src").split('- > on').join('-off')); } > );}); > > jQuery(document).ready(function($){ > $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix( ); > }); > > Jess > > On Oct 11, 2:18 pm, jessie wrote: > > > Hi Rick > > > Thank-you very much yes it did get rid of the error. I'm also > > checking it in firebug and i can't see the other error your getting > > ie. > > $("div.LPButton, div.CatMoreBtn, div.CatBuyBtn").pngFix() is not a > > function > > > Nevertheless the error is gone but now my hovering images don't work! > > > Any reason why this is happening? > > > Thank-you! > > > Jess > > > On Oct 11, 1:15 pm, "Rick Faircloth" wrote: > > > > Well, let's check the bracketing... (I need to format this > > > so I can read it more easily...) > > > > jQuery(function($) { > > > > function getLeaf(url) { > > > > var splited=url.split('?'); > > > url=splited[0]; return url.substring(url.lastIndexOf("/")+1); > > > > } jQuery.fn.extend({ > > > > enter: function() { > > > > return this.each(function() { > > > > var pth = $(this).find("img")[0]; > > > > if ( $(this).children().attr("
[jQuery] Re: My code is not working getting an error missing )
x27;).pngFix(); > > > > }); > > > > jQuery(document).ready(function($) { > > > > $(".button").hover(function() { > > > > $(".button").addClass("imgbuttonhover"); > > > $(".button").removeClass("imgbutton"); > > > > }, function() { > > > > $(".button").addClass("imgbutton"); > > > $(".button").removeClass("imgbuttonhover"); > > > > } > > > ) > > > > }); > > > > After working with this in my editor, this is the bracketing that I used > > > to eliminate the error you were getting. > > > > Now, however, I get this error in Firebug: > > > > $("div.LPButton, div.CatMoreBtn, div.CatBuyBtn").pngFix() is not a > > > function > > > > If you copy the code above and put it in your editor, does the bracketing > > > error go away? > > > > Rick > > > > -Original Message- > > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > > > Behalf Of jessie > > > Sent: Saturday, October 10, 2009 10:12 PM > > > To: jQuery (English) > > > Subject: [jQuery] Re: My code is not working getting an error missing ) > > > > yes the only error now i'm getting is > > > > missing } after function body > > > [Break on this error] ) > > > > Jess > > > > On Oct 11, 12:08 pm, "Rick Faircloth" > > > wrote: > > > > and the only error you're getting is that a ")" is missing? > > > > > -Original Message- > > > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > > > > Behalf Of jessie > > > > Sent: Saturday, October 10, 2009 9:57 PM > > > > To: jQuery (English) > > > > Subject: [jQuery] Re: My code is not working getting an error missing ) > > > > > ok thanx guys, except that didn't resolve the problem. > > > > > I've posted about this before, and still can't get a way around it > > > > all. > > > > > For starters this is what i currently have. > > > > jQuery(function($) { > > > > > function getLeaf(url) { > > > > var splited=url.split('?');// remove all the parameter from url > > > > url=splited[0]; > > > > return url.substring(url.lastIndexOf("/")+1);// return file name > > > > } > > > > jQuery.fn.extend({ > > > > enter: function() {//plugins creation > > > > return this.each(function() { > > > > var pth = $(this).find("img")[0]; > > > > //alert($(this).children().attr("href")); > > > > if($(this).children().attr("href")==getLeaf > > > > (document.location.href)){// check that the link url and document url > > > > > $(pth).attr("src",pth.src.replace(/.png/g, '_active.png')); > > > > } else{ > > > > $(this).hover(function(){ > > > > $(pth).attr("src",pth.src.replace(/.png/ > > > > g,'_active.png'));// mouse over Image > > > > },function(){ > > > > $(pth).attr("src",pth.src.replace(/_active.png/ > > > > g,'.png')); > > > > }); > > > > } > > > > }); > > > > } > > > > }); > > > > jQuery(document).ready(function($){ > > > > $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix( > > > ); > > > > }); > > > > jQuery(document).ready(function($) { > > > > $(".button").hover(function() { > > > > $(".button").addClass("imgbuttonhover"); > > > > $(".button").removeClass("imgbutton"); > > > > }, function() { > > > > $(".button").addClass("imgbutton"); > > > > $(".button").removeClass("imgbuttonhover"); > > > > } > > > > ) > > > > > and its still spitting out an error. > > > > > Second of all this is what i want to do. > > > > > I want any image that is not associated with a form and is only a > > > > hyperlink to rollover using a png fix for ie6. > > > > > I also have forms on my ecommerce site and i need to style these the > > > > same way. So my *buttons within a form* need to also rollover using a > > > > png fix. > > > > > I have been at this for the past week and a half and still can't get > > > > it to work for all. > > > > > The code i have above i've put together from other ppl who have helped > > > > me with my problem of rolling images and buttons. > > > > > Hope someone can help me figure this one out once and for all. > > > > > I'm very very new to jquery and the reason i'd like to use it is > > > > because i want to keep my alt and title text behind my image rollovers > > > > such as buttons ;-) > > > > > Jess :) > > > > > On Oct 11, 11:45 am, "Rick Faircloth" > > > > wrote: > > > > > Now, Matt! I just knew by the time I typed up a long-winded reply, > > > > > > someone would come along and give the short, to-the-point, answer. :op > > > > > > :o) > > > > > > Rick > > > > > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] > > > > > On > > > > > Behalf Of Matt Quackenbush > > > > > Sent: Saturday, October 10, 2009 9:32 PM > > > > > To: jquery-en@googlegroups.com > > > > > Subject: [jQuery] Re: My code is not working getting an error missing > > > > > ) > > > > > > Add a ) to the end. You have to close the opening hover() function > > > call.
[jQuery] Re: My code is not working getting an error missing )
Ok so this is what i want to do and can't achieve. I have images that i'd like to rollover here is the markup for both of those instances, 1 is a button and the other is just a hyperlink it was all working fine until i applied the png fix. which is jquery.pngFix which i downloaded from here http://jquery.andreaseberhard.de/pngFix/ Now i don't know how to fix this i have tried and tried and can't understand what i would need to do to make this all work. I need to use jquery because i want to keep my alt and title tags behind my images. Here is the code i have. which is not working in IE jQuery(function($) { function getLeaf(url) { var splited=url.split('?');// remove all the parameter from url url=splited[0]; return url.substring(url.lastIndexOf("/")+1);// return file name } jQuery.fn.extend({ enter: function() {//plugins creation return this.each(function() { var pth = $(this).find("img")[0]; //alert($(this).children().attr("href")); if($(this).children().attr("href")==getLeaf (document.location.href)){// check that the link url and document url $(pth).attr("src",pth.src.replace(/.png/g, '_active.png')); } else{ $(this).hover(function(){ $(pth).attr("src",pth.src.replace(/.png/ g,'_active.png'));// mouse over Image },function(){ $(pth).attr("src",pth.src.replace(/_active.png/ g,'.png')); }); } }); } }); $(function(){ // Document is ready $(".LPButton,.CatMoreBtn").enter();// call the function }); $('input[type="image"]').hover( function () { $(this).attr("src", $(this).attr("src").split('- off').join('-on')); }, function () { $(this).attr("src", $(this).attr("src").split('- on').join('-off')); } ); }); jQuery(document).ready(function($){ $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix( ); }); Jess On Oct 11, 2:18 pm, jessie wrote: > Hi Rick > > Thank-you very much yes it did get rid of the error. I'm also > checking it in firebug and i can't see the other error your getting > ie. > $("div.LPButton, div.CatMoreBtn, div.CatBuyBtn").pngFix() is not a > function > > Nevertheless the error is gone but now my hovering images don't work! > > Any reason why this is happening? > > Thank-you! > > Jess > > On Oct 11, 1:15 pm, "Rick Faircloth" wrote: > > > Well, let's check the bracketing... (I need to format this > > so I can read it more easily...) > > > jQuery(function($) { > > > function getLeaf(url) { > > > var splited=url.split('?'); > > url=splited[0]; return url.substring(url.lastIndexOf("/")+1); > > > } jQuery.fn.extend({ > > > enter: function() { > > > return this.each(function() { > > > var pth = $(this).find("img")[0]; > > > if ( $(this).children().attr("href") == > > getLeaf(document.location.href) ) > > { $(pth).attr("src",pth.src.replace(/.png/g, > > '_active.png')); } > > > else { $(this).hover(function() { > > > $(pth).attr("src",pth.src.replace(/.png/g,'_active.png')); > > > },function() { > > > $(pth).attr("src",pth.src.replace(/_active.png/g,'.png')); > > > }); > > } > > }); > > } > > }); > > > }); > > > jQuery(document).ready(function($){ > > > $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix(); > > > }); > > > jQuery(document).ready(function($) { > > > $(".button").hover(function() { > > > $(".button").addClass("imgbuttonhover"); > > $(".button").removeClass("imgbutton"); > > > }, function() { > > > $(".button").addClass("imgbutton"); > > $(".button").removeClass("imgbuttonhover"); > > > } > > ) > > > }); > > > After working with this in my editor, this is the bracketing that I used > > to eliminate the error you were getti
[jQuery] Re: My code is not working getting an error missing )
Hi Rick Thank-you very much yes it did get rid of the error. I'm also checking it in firebug and i can't see the other error your getting ie. $("div.LPButton, div.CatMoreBtn, div.CatBuyBtn").pngFix() is not a function Nevertheless the error is gone but now my hovering images don't work! Any reason why this is happening? Thank-you! Jess On Oct 11, 1:15 pm, "Rick Faircloth" wrote: > Well, let's check the bracketing... (I need to format this > so I can read it more easily...) > > jQuery(function($) { > > function getLeaf(url) { > > var splited=url.split('?'); > url=splited[0]; return url.substring(url.lastIndexOf("/")+1); > > } jQuery.fn.extend({ > > enter: function() { > > return this.each(function() { > > var pth = $(this).find("img")[0]; > > if ( $(this).children().attr("href") == > getLeaf(document.location.href) ) > { $(pth).attr("src",pth.src.replace(/.png/g, > '_active.png')); } > > else { $(this).hover(function() { > > $(pth).attr("src",pth.src.replace(/.png/g,'_active.png')); > > },function() { > > $(pth).attr("src",pth.src.replace(/_active.png/g,'.png')); > > }); > } > }); > } > }); > > }); > > jQuery(document).ready(function($){ > > $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix(); > > }); > > jQuery(document).ready(function($) { > > $(".button").hover(function() { > > $(".button").addClass("imgbuttonhover"); > $(".button").removeClass("imgbutton"); > > }, function() { > > $(".button").addClass("imgbutton"); > $(".button").removeClass("imgbuttonhover"); > > } > ) > > }); > > After working with this in my editor, this is the bracketing that I used > to eliminate the error you were getting. > > Now, however, I get this error in Firebug: > > $("div.LPButton, div.CatMoreBtn, div.CatBuyBtn").pngFix() is not a function > > If you copy the code above and put it in your editor, does the bracketing > error go away? > > Rick > > -Original Message- > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > Behalf Of jessie > Sent: Saturday, October 10, 2009 10:12 PM > To: jQuery (English) > Subject: [jQuery] Re: My code is not working getting an error missing ) > > yes the only error now i'm getting is > > missing } after function body > [Break on this error] ) > > Jess > > On Oct 11, 12:08 pm, "Rick Faircloth" > wrote: > > and the only error you're getting is that a ")" is missing? > > > -Original Message- > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > > Behalf Of jessie > > Sent: Saturday, October 10, 2009 9:57 PM > > To: jQuery (English) > > Subject: [jQuery] Re: My code is not working getting an error missing ) > > > ok thanx guys, except that didn't resolve the problem. > > > I've posted about this before, and still can't get a way around it > > all. > > > For starters this is what i currently have. > > jQuery(function($) { > > > function getLeaf(url) { > > var splited=url.split('?');// remove all the parameter from url > > url=splited[0]; > > return url.substring(url.lastIndexOf("/")+1);// return file name > > } > > jQuery.fn.extend({ > > enter: function() {//plugins creation > > return this.each(function() { > > var pth = $(this).find("img")[0]; > > //alert($(this).children().attr("href")); > > if($(this).children().attr("href")==getLeaf > > (document.location.href)){// check that the link url and document url > > > $(pth).attr("src",pth.src.replace(/.png/g, '_active.png')); > > } else{ > > $(this).hover(function(){ > > $(pth).attr("src",pth.src.replace(/.png/ > > g,'_active.png'));// mouse over Image > > },function(){ > > $(pth).attr("src",pth.src.replace(/_active.png/ > > g,'.png'));
[jQuery] Re: My code is not working getting an error missing )
Well, let's check the bracketing... (I need to format this so I can read it more easily...) jQuery(function($) { function getLeaf(url) { var splited=url.split('?'); url=splited[0]; return url.substring(url.lastIndexOf("/")+1); } jQuery.fn.extend({ enter: function() { return this.each(function() { var pth = $(this).find("img")[0]; if ( $(this).children().attr("href") == getLeaf(document.location.href) ) { $(pth).attr("src",pth.src.replace(/.png/g, '_active.png')); } else { $(this).hover(function() { $(pth).attr("src",pth.src.replace(/.png/g,'_active.png')); },function() { $(pth).attr("src",pth.src.replace(/_active.png/g,'.png')); }); } }); } }); }); jQuery(document).ready(function($){ $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix(); }); jQuery(document).ready(function($) { $(".button").hover(function() { $(".button").addClass("imgbuttonhover"); $(".button").removeClass("imgbutton"); }, function() { $(".button").addClass("imgbutton"); $(".button").removeClass("imgbuttonhover"); } ) }); After working with this in my editor, this is the bracketing that I used to eliminate the error you were getting. Now, however, I get this error in Firebug: $("div.LPButton, div.CatMoreBtn, div.CatBuyBtn").pngFix() is not a function If you copy the code above and put it in your editor, does the bracketing error go away? Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of jessie Sent: Saturday, October 10, 2009 10:12 PM To: jQuery (English) Subject: [jQuery] Re: My code is not working getting an error missing ) yes the only error now i'm getting is missing } after function body [Break on this error] ) Jess On Oct 11, 12:08 pm, "Rick Faircloth" wrote: > and the only error you're getting is that a ")" is missing? > > -Original Message- > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > Behalf Of jessie > Sent: Saturday, October 10, 2009 9:57 PM > To: jQuery (English) > Subject: [jQuery] Re: My code is not working getting an error missing ) > > ok thanx guys, except that didn't resolve the problem. > > I've posted about this before, and still can't get a way around it > all. > > For starters this is what i currently have. > jQuery(function($) { > > function getLeaf(url) { > var splited=url.split('?');// remove all the parameter from url > url=splited[0]; > return url.substring(url.lastIndexOf("/")+1);// return file name > } > jQuery.fn.extend({ > enter: function() {//plugins creation > return this.each(function() { > var pth = $(this).find("img")[0]; > //alert($(this).children().attr("href")); > if($(this).children().attr("href")==getLeaf > (document.location.href)){// check that the link url and document url > > $(pth).attr("src",pth.src.replace(/.png/g, '_active.png')); > } else{ > $(this).hover(function(){ > $(pth).attr("src",pth.src.replace(/.png/ > g,'_active.png'));// mouse over Image > },function(){ > $(pth).attr("src",pth.src.replace(/_active.png/ > g,'.png')); > }); > } > }); > } > }); > jQuery(document).ready(function($){ > $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix( ); > }); > jQuery(document).ready(function($) { > $(".button").hover(function() { > $(".button").addClass("imgbuttonhover"); > $(".button").removeClass("imgbutton"); > }, function() { > $(".button").addClass("imgbutton"); > $(".button").removeClass("imgbuttonhover"); > } > ) > > and its still spitting out an error. > > Second of all this is what i want to do. > > I want any image that is not associated with a form and is only a > hyperlink to rollover using a png fix for ie6. > > I also have forms on my ecommerce site and i need to style these the > same way. So my *buttons within a form* need t
[jQuery] Re: My code is not working getting an error missing )
yes the only error now i'm getting is missing } after function body [Break on this error] ) Jess On Oct 11, 12:08 pm, "Rick Faircloth" wrote: > and the only error you're getting is that a ")" is missing? > > -Original Message- > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > Behalf Of jessie > Sent: Saturday, October 10, 2009 9:57 PM > To: jQuery (English) > Subject: [jQuery] Re: My code is not working getting an error missing ) > > ok thanx guys, except that didn't resolve the problem. > > I've posted about this before, and still can't get a way around it > all. > > For starters this is what i currently have. > jQuery(function($) { > > function getLeaf(url) { > var splited=url.split('?');// remove all the parameter from url > url=splited[0]; > return url.substring(url.lastIndexOf("/")+1);// return file name > } > jQuery.fn.extend({ > enter: function() {//plugins creation > return this.each(function() { > var pth = $(this).find("img")[0]; > //alert($(this).children().attr("href")); > if($(this).children().attr("href")==getLeaf > (document.location.href)){// check that the link url and document url > > $(pth).attr("src",pth.src.replace(/.png/g, '_active.png')); > } else{ > $(this).hover(function(){ > $(pth).attr("src",pth.src.replace(/.png/ > g,'_active.png'));// mouse over Image > },function(){ > $(pth).attr("src",pth.src.replace(/_active.png/ > g,'.png')); > }); > } > }); > } > }); > jQuery(document).ready(function($){ > $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix( ); > }); > jQuery(document).ready(function($) { > $(".button").hover(function() { > $(".button").addClass("imgbuttonhover"); > $(".button").removeClass("imgbutton"); > }, function() { > $(".button").addClass("imgbutton"); > $(".button").removeClass("imgbuttonhover"); > } > ) > > and its still spitting out an error. > > Second of all this is what i want to do. > > I want any image that is not associated with a form and is only a > hyperlink to rollover using a png fix for ie6. > > I also have forms on my ecommerce site and i need to style these the > same way. So my *buttons within a form* need to also rollover using a > png fix. > > I have been at this for the past week and a half and still can't get > it to work for all. > > The code i have above i've put together from other ppl who have helped > me with my problem of rolling images and buttons. > > Hope someone can help me figure this one out once and for all. > > I'm very very new to jquery and the reason i'd like to use it is > because i want to keep my alt and title text behind my image rollovers > such as buttons ;-) > > Jess :) > > On Oct 11, 11:45 am, "Rick Faircloth" > wrote: > > Now, Matt! I just knew by the time I typed up a long-winded reply, > > > someone would come along and give the short, to-the-point, answer. :op > > > :o) > > > Rick > > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > > Behalf Of Matt Quackenbush > > Sent: Saturday, October 10, 2009 9:32 PM > > To: jquery-en@googlegroups.com > > Subject: [jQuery] Re: My code is not working getting an error missing ) > > > Add a ) to the end. You have to close the opening hover() function call.
[jQuery] Re: My code is not working getting an error missing )
and the only error you're getting is that a ")" is missing? -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of jessie Sent: Saturday, October 10, 2009 9:57 PM To: jQuery (English) Subject: [jQuery] Re: My code is not working getting an error missing ) ok thanx guys, except that didn't resolve the problem. I've posted about this before, and still can't get a way around it all. For starters this is what i currently have. jQuery(function($) { function getLeaf(url) { var splited=url.split('?');// remove all the parameter from url url=splited[0]; return url.substring(url.lastIndexOf("/")+1);// return file name } jQuery.fn.extend({ enter: function() {//plugins creation return this.each(function() { var pth = $(this).find("img")[0]; //alert($(this).children().attr("href")); if($(this).children().attr("href")==getLeaf (document.location.href)){// check that the link url and document url $(pth).attr("src",pth.src.replace(/.png/g, '_active.png')); } else{ $(this).hover(function(){ $(pth).attr("src",pth.src.replace(/.png/ g,'_active.png'));// mouse over Image },function(){ $(pth).attr("src",pth.src.replace(/_active.png/ g,'.png')); }); } }); } }); jQuery(document).ready(function($){ $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix( ); }); jQuery(document).ready(function($) { $(".button").hover(function() { $(".button").addClass("imgbuttonhover"); $(".button").removeClass("imgbutton"); }, function() { $(".button").addClass("imgbutton"); $(".button").removeClass("imgbuttonhover"); } ) and its still spitting out an error. Second of all this is what i want to do. I want any image that is not associated with a form and is only a hyperlink to rollover using a png fix for ie6. I also have forms on my ecommerce site and i need to style these the same way. So my *buttons within a form* need to also rollover using a png fix. I have been at this for the past week and a half and still can't get it to work for all. The code i have above i've put together from other ppl who have helped me with my problem of rolling images and buttons. Hope someone can help me figure this one out once and for all. I'm very very new to jquery and the reason i'd like to use it is because i want to keep my alt and title text behind my image rollovers such as buttons ;-) Jess :) On Oct 11, 11:45 am, "Rick Faircloth" wrote: > Now, Matt! I just knew by the time I typed up a long-winded reply, > > someone would come along and give the short, to-the-point, answer. :op > > :o) > > Rick > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > Behalf Of Matt Quackenbush > Sent: Saturday, October 10, 2009 9:32 PM > To: jquery-en@googlegroups.com > Subject: [jQuery] Re: My code is not working getting an error missing ) > > Add a ) to the end. You have to close the opening hover() function call.
[jQuery] Re: My code is not working getting an error missing )
ok thanx guys, except that didn't resolve the problem. I've posted about this before, and still can't get a way around it all. For starters this is what i currently have. jQuery(function($) { function getLeaf(url) { var splited=url.split('?');// remove all the parameter from url url=splited[0]; return url.substring(url.lastIndexOf("/")+1);// return file name } jQuery.fn.extend({ enter: function() {//plugins creation return this.each(function() { var pth = $(this).find("img")[0]; //alert($(this).children().attr("href")); if($(this).children().attr("href")==getLeaf (document.location.href)){// check that the link url and document url $(pth).attr("src",pth.src.replace(/.png/g, '_active.png')); } else{ $(this).hover(function(){ $(pth).attr("src",pth.src.replace(/.png/ g,'_active.png'));// mouse over Image },function(){ $(pth).attr("src",pth.src.replace(/_active.png/ g,'.png')); }); } }); } }); jQuery(document).ready(function($){ $('div.LPButton, div.CatMoreBtn, div.CatBuyBtn').pngFix( ); }); jQuery(document).ready(function($) { $(".button").hover(function() { $(".button").addClass("imgbuttonhover"); $(".button").removeClass("imgbutton"); }, function() { $(".button").addClass("imgbutton"); $(".button").removeClass("imgbuttonhover"); } ) and its still spitting out an error. Second of all this is what i want to do. I want any image that is not associated with a form and is only a hyperlink to rollover using a png fix for ie6. I also have forms on my ecommerce site and i need to style these the same way. So my *buttons within a form* need to also rollover using a png fix. I have been at this for the past week and a half and still can't get it to work for all. The code i have above i've put together from other ppl who have helped me with my problem of rolling images and buttons. Hope someone can help me figure this one out once and for all. I'm very very new to jquery and the reason i'd like to use it is because i want to keep my alt and title text behind my image rollovers such as buttons ;-) Jess :) On Oct 11, 11:45 am, "Rick Faircloth" wrote: > Now, Matt! I just knew by the time I typed up a long-winded reply, > > someone would come along and give the short, to-the-point, answer. :op > > :o) > > Rick > > From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > Behalf Of Matt Quackenbush > Sent: Saturday, October 10, 2009 9:32 PM > To: jquery-en@googlegroups.com > Subject: [jQuery] Re: My code is not working getting an error missing ) > > Add a ) to the end. You have to close the opening hover() function call.
[jQuery] Re: My code is not working getting an error missing )
Now, Matt! I just knew by the time I typed up a long-winded reply, someone would come along and give the short, to-the-point, answer. :op :o) Rick From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Matt Quackenbush Sent: Saturday, October 10, 2009 9:32 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: My code is not working getting an error missing ) Add a ) to the end. You have to close the opening hover() function call.
[jQuery] Re: My code is not working getting an error missing )
I'm not sure what the code surrounding your code looks like, but from the code below, it looks like you're missing a ")" at the end to close the first "(" after .hover ... This should work: $(".button").hover(function() { $(".button").addClass("imgbuttonhover"); $(".button").removeClass("imgbutton"); }, function() { $(".button").addClass("imgbutton); $(".button").removeClass("imgbuttonhover); } ) The code above, I guess, is surrounded by $(document).ready(function() { ? As in: $(document).ready(function() { $(".button").hover(function() { $(".button").addClass("imgbuttonhover"); $(".button").removeClass("imgbutton"); }, function() { $(".button").addClass("imgbutton"); $(".button").removeClas("imgbuttonhover"); } ) }); A few observations about the code above that might be helpful... - consider using an ID for the button instead of a class, say, "myButton" (Unless for some reason you have multiple buttons you want to rollover at the same time) - then use two classes to swap the img: .button and .buttonHover - also, after the first reference to the button in the second line above, you can refer to the button as "this", which according to my understanding will speed up jQuery's reference to the button, keeping it from having to search the DOM for a match by having a "ready reference" to it by using "this" The code would then look like this: (A div used for the rollover, would work like this using color instead of an img) HTML: CSS: .button { background:#abc; width:50opx; height:50px; } .buttonHover { background:#def; width:50px; height:50px; } JQUERY: $(document).ready(function() { $("#myButton").hover(function() { $(this).removeClass("button"); $(this).addClass("buttonHover"); }, function () { $(this).removeClass("buttonHover"); $(this).addClass("button"); } ) }); Of course, to use images for the rollover, just modify the CSS. hth, Rick -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of jessie Sent: Saturday, October 10, 2009 9:03 PM To: jQuery (English) Subject: [jQuery] My code is not working getting an error missing ) Hi Everyone I have been given this code to add to my effects.js $(".button").hover(function() { $(".button").addClass("imgbuttonhover"); $(".button").removeClass("imgbutton"); }, function() { $(".button").addClass("imgbutton"); $(".button").removeClass("imgbuttonhover"); } But when i add it to my file i get this error via firefox. missing ) after argument list [Break on this error] }\n Can someone please tell me what i'm missing? Thank-you. Jess
[jQuery] Re: My code is not working getting an error missing )
Add a ) to the end. You have to close the opening hover() function call.