Grow your CSS skills. Land your dream job.

optgroup (parent/child relationships)

  • # February 13, 2013 at 7:35 pm

    i need to makes optgroups in the select based on the parent/child relationships

    when i look my web at smartphone or tablet… i cant see a separation for father menu. (www.benditaflor.cl)

    how can i make this visual variation?

    _Actually code in scripts.js is:_

    // Create the dropdown base
    jQuery(““).appendTo(“#main-menu-wrapper”);

    // Create default option “Go to…”
    jQuery(““, {
    “selected”: “selected”,
    “value” : “”,
    “text” : goText
    }).appendTo(“#main-menu-wrapper select”);

    // Populate dropdown with menu items
    jQuery(“#main-menu a”).each(function() {
    var el = jQuery(this);
    jQuery(““, {
    “value” : el.attr(“href”),
    “text” : el.text()
    }).appendTo(“#main-menu-wrapper select”);
    });

    // To make dropdown actually work
    jQuery(“#main-menu-wrapper select”).change(function() {
    window.location = jQuery(this).find(“option:selected”).val();
    });

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".