I am starting to learn jQuery now and have added a couple effects
(table sorter and whatnot) so far to my blog at: http://ocmexfood.blogspot.com/.
One thing I want to do with it is to turn off certain page elements if
the current URL equals a certain string. For example: I have a number
of different entries on Mexican food at Disneyland but sometimes
visitors will look at one entry and then leave the blog without
finding the information they were looking for and usually it's because
they don't click (or know about) the "disneyland" tag at the bottom of
each entry. So yesterday I created the following image:

http://www.ocmexfood.com/images/panchitoMessage.gif

I put the image in each separate Disneyland entry and linked it to the
tag, which all works good, except that once people are in the
"disneyland" tag (http://ocmexfood.blogspot.com/search/label/
disneyland) I don't want them to have to see the image anymore. Not
only will it show up about 13 times but it may confuse some visitors,
making them think that they are still not on the correct page. So my
first attempt at creating a jQuery statement (once I added the jqURL
plugin in) was:

$.jqURL.url(http://ocmexfood.blogspot.com/search/label/disneyland) {

$('IMG[src="http://www.ocmexfood.com/images/
panchitoMessage.gif"]').addClass('noDisplay');

}

Now that may be laughable or it may be close. I don't really
know . . . but it didn't work. What I'm basically trying to get the
statement to say is, "If the current URL equals 'http://
ocmexfood.blogspot.com/search/label/disneyland' then add the class
'noDisplay' to any instance of the panchitoMessage.gif image occurring
on the page. Of course, the class 'noDisplay' in the style sheet is
set to display: none.


UPDATE: The person I had e-mailed this problem to responded with this
script:

if ( $.jqURL.url() == "http://ocmexfood.blogspot.com/search/label/
disneyland" ) {
  $('IMG[src="http://www.ocmexfood.com/images/
panchitoMessage.gif"]').addClass('noDisplay');
}

Which *does* seem like it should work . . . but it doesn't. After
writing back to tell him it didn't work I never heard from him again.
Any insights would be greatly appreciated. Thanks!

Reply via email to