1

在我在http://www.wrcc.dri.edu/monitor/WWDT/index.php看到的树形菜单中,有没有一种方法可以使变量子菜单和区域子菜单相互独立,以便在单击时变粗...因此,例如,如果我单击 PDSI,我希望它变为粗体,然后如果我单击 Arizona,我希望它也变为粗体。当用户点击它时,我希望变量和区域都是粗体。这使得用户只需查看树形菜单就更容易知道他/她点击了什么。现在,只有活动的或最近单击的变量/区域变为粗体。

您可以查看我的源代码并看到我现在拥有:

<script type="text/javascript">
$(function () {
    $('#variable').find('a').each(function () {
        if (this.href == location.href) {
            $(this).addClass('Active');
        } else {
            $(this).removeClass('Active');
        }
    });
});
</script>

<script type="text/javascript">
$(function () {
    $('#region').find('a').each(function () {
        if (this.href == location.href) {
            $(this).addClass('Active');
        } else {
            $(this).removeClass('Active');
        }
    });
</script>
4

0 回答 0