WordPress.org

Ready to get started?Download WordPress

Forums

jQuery Archive List Widget
[resolved] Expands and collapses on click (5 posts)

  1. Joe Lowery
    Member
    Posted 1 year ago #

    I love this plug-in - but I can't get it to work properly. I get the years to display, but clicking on an individual year doesn't expand to display the months as it should. Instead, I have to click again and then it expands and immediately collapses.

    You can see this behavior at http://ac.lowerytest.com/blog/ in the sidebar under Archives. Click "Dates" to expand the years.

    I'm using a jQuery routine to expand Tags and Categories:

    $('.childrn > li a').click(function(e) {
    	$(this).parent().find('ul').toggle();
    });

    Note that I use the class 'childrn' not 'children' so as not to conflict with jQuery Archive List, but it's still not working.

    Any help you can offer?

    Thanks so much for your work and help. I've made a small donation via PayPal whether you can give me a hand or not. Keep it up!

    Best - Joe

    http://wordpress.org/extend/plugins/jquery-archive-list-widget/

  2. Miguel Useche
    Member
    Plugin Author

    Posted 1 year ago #

    Wow thanks for the donation :) it helps me to dedicate time to this plugin. I really appreciate it.

    About your problem, you're asigning multiple click function to years because .children > li a will search for hyperlinks after inmediatly li under children, and that includes hyperlinks under my plugins.

    Just delete that function and use this one:

    jQuery('.childrn > li > a').on('click', function(e) {
        e.preventDefault();
        console.log('true');
    	jQuery(this).parent().find('ul').toggle();
    });

    This selector will search only for the hyperlinks under the link under children, it doesn't go deeper. Also i've used on function used in newer jQuery versions, and added a preventDefault to avoid going to any url.

    I suggest you to remove any href="javascriot:void()" because it looks bad and it's bad for SEO/robots. Add a href="#date" and will work with the js code included in this message.

  3. Joe Lowery
    Member
    Posted 1 year ago #

    That's perfect, Miguel. Thanks so much!

    Best - Joe

  4. Miguel Useche
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks to you for the donation, it made my day :)

  5. Joe Lowery
    Member
    Posted 1 year ago #

    You're entirely welcome! Your quick, accurate response really made mine, so I consider us even :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic