Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS jquery show/hide and some other questions

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #23347
    cssgirl
    Participant

    Question:

    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.
    Lindsey

    #50267
    cssgirl
    Participant

    Weird question:

    What’s up with the jump and content being shown near bottom of circles when clicked in IE6?

    #50273
    pab
    Member

    ah 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.

    #50274
    cssgirl
    Participant

    Thanks 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!

    #50277
    cssgirl
    Participant

    Ok, 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
    Chain

    Lorem 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:

    http://dev.cssgirl.com/r/rondaxe/cmc.html

    #50292
    cssgirl
    Participant

    I 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 ;)!!!

    #50294
    pab
    Member

    I’ve had that same issue with jquery

    happens once in a blue moon.

    #50308
    cssgirl
    Participant

    Yeah, 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!

    #50309
    Spunkmeyer
    Member

    Looks pretty cool! Good work!

    #50262
    cssgirl
    Participant

    Ok, 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?

    #50388
    At_the_Gates
    Participant

    This 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

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘CSS’ is closed to new topics and replies.