- This topic is empty.
-
AuthorPosts
-
October 2, 2008 at 4:06 pm #23347
cssgirl
ParticipantQuestion:
I’m using jquery to show/hid content on a website. I have just the part I’m trying to show/hid content with here:
http://dev.cssgirl.com/r/rondaxe/cmc.html
As you see I’ve got my images cut up and sprited, and the hover actions working and on the top two links (drug product development and process research + development) I have the links hooked up with some jquery to hide some content until their clicked on then it’s shown.
Here’s what I want to do that I can’t quite figure out:
I want those bubbles to stay green when the content is being displayed for it. I know kinda how I can do it (have a class added to that link when it’s clicked and the content is showing) but how to I tell the jquery/DOM to do that?
Thanks.
LindseyOctober 2, 2008 at 8:06 pm #50267cssgirl
ParticipantWeird question:
What’s up with the jump and content being shown near bottom of circles when clicked in IE6?
October 3, 2008 at 1:44 am #50273pab
Memberah jquery you make writing scripts so much easier, Lindsey I just got karl Swedberg’s book in the mail, I highly recommend it.
Bear Bibault’ book is good too.
October 3, 2008 at 8:34 am #50274cssgirl
ParticipantThanks Chris and pab. I’ll definitely check out those books.
My first real messing around and editing things my way with jquery.
Really appreciate the help!
October 3, 2008 at 9:39 am #50277cssgirl
ParticipantOk, sooo hopefully this will be the last question…
I tried this:
Code:$(‘a.research-dev’).addClass(“active”).click(function() {
hideAll();
$(‘#research-dev’).show(400);
return false;
});But it made all the circles green onload. So I tried switching it and adding the active class within the click(function() { like so:
Code:$(‘a.research-dev’).click(function() {
hideAll();
$(‘#research-dev’).show(400);
addClass(“active”)
return false;
});Make the circles load as blue again, but still not keeping green on click.
So, I tried using "switchClass" instead, with same results. Not staying green. So I’m stuck again.
Here’s my jquery:
Code:$(document).ready(function() {
// hides the slickbox as soon as the DOM is ready
// (a little sooner than page load)
$(‘#product-dev’).hide();
$(‘#research-dev’).hide();
$(‘#chem-dev’).hide();
$(‘#fermentation’).hide();
$(‘#analytical’).hide();
$(‘#regulatory’).hide();
$(‘#quality’).hide();
$(‘#strategy’).hide();
$(‘#chain’).hide();function hideAll() {
$(‘#research-dev’).hide(400);
$(‘#chem-dev’).hide(400);
$(‘#fermentation’).hide(400);
$(‘#analytical’).hide(400);
$(‘#regulatory’).hide(400);
$(‘#quality’).hide(400);
$(‘#strategy’).hide(400);
$(‘#chain’).hide(400);
$(‘#product-dev’).hide(400);
$(‘a’).removeClass(“selected”); // Also remove class on anchor
};// toggles the slickbox on clicking the noted link
$(‘a.prod-dev’).click(function() {
hideAll();
$(‘#product-dev’).show(400);
addClass(“selected”);
return false;
});$(‘a.research-dev’).click(function() {
hideAll();
$(‘#research-dev’).show(400);
switchClass(‘research-dev’, ‘research-on’, 400);
return false;
});$(‘a.chem-dev’).click(function() {
hideAll();
$(‘#chem-dev’).show(400);
addClass(“selected”);
return false;
});$(‘a.fermentation’).click(function() {
hideAll();
$(‘#fermentation’).show(400);
addClass(“selected”);
return false;
});$(‘a.analytical’).click(function() {
hideAll();
$(‘#analytical’).show(400);
addClass(“selected”);
return false;
});$(‘a.regulatory’).click(function() {
hideAll();
$(‘#regulatory’).show(400);
addClass(“selected”);
return false;
});$(‘a.quality’).click(function() {
hideAll();
$(‘#quality’).show(400);
addClass(“selected”);
return false;
});$(‘a.strategy’).click(function() {
hideAll();
$(‘#strategy’).show(400);
addClass(“selected”);
return false;
});$(‘a.chain’).click(function() {
hideAll();
$(‘#chain’).show(400);
addClass(“selected”);
return false;
});});
And my CSS/HTML
Code:
CMC
Product Development
Research Development
Chemical Development
Fermentationt
Analytical
Regulatory
Quality
Strategy
ChainLorem ipsum dolor. Set frigilla a.Set frigilla a. Lorem ipsum dolor.Lorem ipsum dolor. Lorem ipsum dolor. Set frigilla a.Lorem ipsum dolor. Set frigilla a. Lorem ipsum dolor.Lorem ipsum dolor. Set frigilla a. Lorem ipsum dolor. Lorem ipsum dolor.Set frigilla a. Lorem ipsum dolor. Lorem ipsum dolor. Lorem ipsum dolor.Lorem ipsum dolor. Lorem ipsum dolor. Set frigilla a.Lorem ipsum dolor. Set frigilla a. Lorem ipsum dolor.Lorem ipsum dolor. Set frigilla a. Lorem ipsum dolor.What am I doing wrong here?
Demo is here:
October 3, 2008 at 6:37 pm #50292cssgirl
ParticipantI don’t know what I did wrong before. I even looked up the addClass thing on jquery.com and add the $(this) but couldn’t get it to work. Whatever though now after I pasted in the way you have shown it does. Many, many thanks ;)!!!
October 3, 2008 at 7:22 pm #50294pab
MemberI’ve had that same issue with jquery
happens once in a blue moon.
October 5, 2008 at 10:33 pm #50308cssgirl
ParticipantYeah, hopefully with more experience I’ll get this down one day ;P
And I got the finished product up finally if you all want to check it out:
http://dev.ketanvakil.com/rondaxe.com/s … ulting.php
and
http://dev.ketanvakil.com/rondaxe.com/services/I even figured out the .hover solution for show/hide all by myself :) Practice, practice, practice!
Thanks again guys!
October 5, 2008 at 10:36 pm #50309Spunkmeyer
MemberLooks pretty cool! Good work!
October 6, 2008 at 12:15 pm #50262cssgirl
ParticipantOk, one last question ;) Promise:
If you view either of those pages in IE6/IE7 you will see little black dots when the hover/click effects are taking place (ie: the show/hide). Looks like an IE issue with the redrawing or whatever you call it. Solutions?
October 8, 2008 at 12:03 pm #50388At_the_Gates
ParticipantThis always seems to happen in IE when using show/hide – you also get really nasty un-aliased type (ClearType won’t apply itself for some reason).
You can workaround it easily by using the sliding effects:
.slideUp()
.slideDown()
.slideToggle()instead of
.show()
.hide()
.toggle()James
-
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.