# When in a category, default to "none" rather than "all" subcategories

**URL:** <https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173>\
**Category:** Support\
**Created:** [March 10, 2015, 4:40pm UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173 "2015-03-10T16:40:49Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Maestra\_Powers](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/maestra_powers/32/37362_2.png) [@Maestra\_Powers](https://meta.discourse.org/u/Maestra_Powers)\
**Post date:** [March 14, 2015, 7:26pm UTC](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173/4 "2015-03-14T19:26:16Z")

</div>

Fixed it via JS. You have to add this code to your head.

```
// For categories list
$(document).on('mouseover', 'td.category div.pull-left a', function() {
    // do it only once
    if ($(this).hasClass('link-fixed')) {
        return;
    }
    
    // do it only if there's subcategories
    if ($(this).parents('td.category').find('div.subcategories').length) {
        var link = $(this).prop('href');
        $(this).prop('href', link+'/none');
    }
    
    $(this).addClass('link-fixed');
});

// For dropdowns
$(document).on('click', 'ol.category-breadcrumb li', function() {
    // do it only once
    if ($(this).hasClass('links-fixed')) {
        return;
    }
    
    // do it only for first dropdown
    $(this).addClass('list-clicked');
    if (!$('ol.category-breadcrumb li').slice(0, 1).hasClass('list-clicked')) {
        $(this).removeClass('list-clicked');
        return;
    }
    $(this).removeClass('list-clicked');
    
    // you can't check subcategories from here, so doing it for all
    $(this).find('section.category-dropdown-menu div.cat a').each(function() {
        if (!$(this).hasClass('home')) {
            var link = $(this).prop('href');
            $(this).prop('href', link+'/none');
        }
    });
    
    $(this).addClass('links-fixed');
});

// For breadcrumbs when reading a topic
$(document).on('mouseover', '.title-wrapper .ember-view a', function() {
    // do it only once
    if ($(this).hasClass('link-fixed')) {
        return;
    }
    
    // do it only for first button
    $(this).addClass('list-clicked');
    if (!$('.title-wrapper .ember-view a').slice(0, 1).hasClass('list-clicked')) {
        $(this).removeClass('list-clicked');
        return;
    }
    $(this).removeClass('list-clicked');
    
    var link = $(this).prop('href');
    $(this).prop('href', link+'/none');
    
    $(this).addClass('link-fixed');
});

```

I don’t think this will work on phones. There’s probably no such events as “mouseover”.

---

_[View the full topic](https://meta.discourse.org/t/when-in-a-category-default-to-none-rather-than-all-subcategories/26173)._
