kandi background
Explore Kits

BottomBar | custom view component

 by   roughike Java Version: V2.3.1 License: Apache-2.0

 by   roughike Java Version: V2.3.1 License: Apache-2.0

Download this library from

kandi X-RAY | BottomBar Summary

BottomBar is a Java library. BottomBar has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub.
Specify a different layout for your activity in res/layout-sw600dp folder and set bb_tabletMode to true.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • BottomBar has a medium active ecosystem.
  • It has 8452 star(s) with 1577 fork(s). There are 250 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 264 open issues and 478 have been closed. On average issues are closed in 162 days. There are 25 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of BottomBar is V2.3.1
BottomBar Support
Best in #Java
Average in #Java
BottomBar Support
Best in #Java
Average in #Java

quality kandi Quality

  • BottomBar has 0 bugs and 97 code smells.
BottomBar Quality
Best in #Java
Average in #Java
BottomBar Quality
Best in #Java
Average in #Java

securitySecurity

  • BottomBar has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • BottomBar code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
BottomBar Security
Best in #Java
Average in #Java
BottomBar Security
Best in #Java
Average in #Java

license License

  • BottomBar is licensed under the Apache-2.0 License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
BottomBar License
Best in #Java
Average in #Java
BottomBar License
Best in #Java
Average in #Java

buildReuse

  • BottomBar releases are available to install and integrate.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • BottomBar saves you 1664 person hours of effort in developing the same functionality from scratch.
  • It has 3691 lines of code, 302 functions and 71 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
BottomBar Reuse
Best in #Java
Average in #Java
BottomBar Reuse
Best in #Java
Average in #Java
Top functions reviewed by kandi - BETA

kandi has reviewed BottomBar and discovered the below as its top functions. This is intended to give you an instant insight into BottomBar implemented functionality, and help decide if they suit your requirements.

  • Update the bottom bar items .
  • Parses a new tab .
  • Updates the width of the badge .
  • Converts a tab item id to a textual message
  • Checks if soft keys are available .
  • Initializes the dialog .
  • Wrap tab and badge in the same way .
  • Gets a bottom navigation behavior from a parent view .
  • Toggles the visibility of the bottom bar .
  • This method is called when a child view is nested or down .

BottomBar Key Features

Cleaner code and better APIs

No more unnecessary stuff or spaghetti mess

Now the look, feel and behavior is defined in XML, as it should be

No more nasty regressions, thanks to the automated tests

Everything is a little different compared to earlier, but it's for the greater good!

Gimme that Gradle sweetness, pls?

copy iconCopydownload iconDownload
compile 'com.roughike:bottom-bar:2.3.1'

Adding items from XML resource

copy iconCopydownload iconDownload
<tabs>
    <tab
        id="@+id/tab_favorites"
        icon="@drawable/ic_favorites"
        title="Favorites" />
    <tab
        id="@+id/tab_nearby"
        icon="@drawable/ic_nearby"
        title="Nearby" />
    <tab
        id="@+id/tab_friends"
        icon="@drawable/ic_friends"
        title="Friends" />
</tabs>

Setting up listeners

copy iconCopydownload iconDownload
public class MainActivity extends Activity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
        bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
            @Override
            public void onTabSelected(@IdRes int tabId) {
                if (tabId == R.id.tab_favorites) {
                    // The tab with id R.id.tab_favorites was selected,
                    // change your content accordingly.
                }
            }
        });
    }
}

Intercepting tab selections

copy iconCopydownload iconDownload
bottomBar.setTabSelectionInterceptor(new TabSelectionInterceptor() {
    @Override
    public boolean shouldInterceptTabSelection(@IdRes int oldTabId, @IdRes int newTabId) {
        if (newTabId == R.id.tab_pro_feature && !userHasProVersion()) {
          startProVersionPurchaseFlow();
          return true;
        }
        
        return false;
    }
});

Changing icons based on selection state

copy iconCopydownload iconDownload
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/ic_myicon_selected" android:state_selected="true" />
    <item android:drawable="@drawable/ic_myicon_default" android:state_selected="false" />
</selector>

Those color changing tabs look dope. Howdoidodat?

copy iconCopydownload iconDownload
<tabs>
    <tab
        id="@+id/tab_favorites"
        icon="@drawable/ic_favorites"
        title="Favorites"
        barColorWhenSelected="#5D4037" />
    <!-- You can use @color resources too! -->
</tabs>

How do I draw it under the navbar?

copy iconCopydownload iconDownload
<style name="AppTheme.TransNav" parent="AppTheme">
    <item name="android:navigationBarColor">@android:color/transparent</item>
    <item name="android:windowTranslucentNavigation">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>

What about Tablets?

copy iconCopydownload iconDownload
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.roughike.bottombar.BottomBar
        android:id="@+id/bottomBar"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        app:bb_tabXmlResource="@xml/bottombar_tabs_three"
        app:bb_tabletMode="true" />

    <!-- This could be your fragment container, or something -->
    <FrameLayout
        android:id="@+id/contentContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_toRightOf="@+id/bottomBar" />

</RelativeLayout>

How do I hide it automatically on scroll?

copy iconCopydownload iconDownload
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/myScrollingContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <!-- Your loooooong scrolling content here. -->

    </android.support.v4.widget.NestedScrollView>

    <com.roughike.bottombar.BottomBar
        android:id="@+id/bottomBar"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_gravity="bottom"
        app:bb_tabXmlResource="@xml/bottombar_tabs_three"
        app:bb_behavior="shy"/>

</android.support.design.widget.CoordinatorLayout>

Badges

copy iconCopydownload iconDownload
BottomBarTab nearby = bottomBar.getTabWithId(R.id.tab_nearby);
nearby.setBadgeCount(5);

// Remove the badge when you're done with it.
nearby.removeBadge/();

For the BottomBar

copy iconCopydownload iconDownload
<com.roughike.bottombar.BottomBar
    android:id="@+id/bottomBar"
    android:layout_width="match_parent"
    android:layout_height="60dp"
    android:layout_alignParentBottom="true"
    app:bb_tabXmlResource="@xml/bottombar_tabs_three"
    app:bb_tabletMode="true"
    app:bb_behavior="shifting|shy|underNavbar"
    app:bb_inActiveTabAlpha="0.6"
    app:bb_activeTabAlpha="1"
    app:bb_inActiveTabColor="#222222"
    app:bb_activeTabColor="@color/colorPrimary"
    app:bb_badgesHideWhenActive="true"
    app:bb_titleTextAppearance="@style/MyTextAppearance"
    app:bb_titleTypeFace="fonts/MySuperDuperFont.ttf"
    app:bb_showShadow="true" />

For the tabs

copy iconCopydownload iconDownload
<tab
    id="@+id/tab_recents"
    title="Recents"
    icon="@drawable/empty_icon"
    inActiveColor="#00FF00"
    activeColor="#FF0000"
    barColorWhenSelected="#FF0000"
    badgeBackgroundColor="#FF0000"
    badgeHidesWhenActive="true" />

License

copy iconCopydownload iconDownload
BottomBar library for Android
Copyright (c) 2016 Iiro Krankka (http://github.com/roughike).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Set after value for DIV dynamically

copy iconCopydownload iconDownload
 .bottombarcontainer .bottombar input[type="radio"]:checked + .round {
  transform: translate(0, -7px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
  background: white;
  border:8px solid #66ccff ;
}

how can I change the text color if it focused?

copy iconCopydownload iconDownload
options={{
  tabBarLabel: ({focused, color, size}) => (
    <Text style={{color: focused ? 'red' : color}}>Updates</Text>
  ),
}}
const Tab = createBottomTabNavigator();
function MyTabs() {
  return (
    <Tab.Navigator>
      <Tab.Screen
        options={{
          tabBarLabel: ({focused, color, size}) => (
            <Text style={{color: focused ? 'red' : color}}>Updates</Text>
          ),
          tabBarIcon: ({color, size}) => (
            <MaterialCommunityIcons name="bell" color={color} size={size} />
          ),
        }}
        name="Home"
        component={HomeScreen}
      />
      <Tab.Screen
        options={{
          tabBarLabel: ({focused, color, size}) => (
            <Text style={{color: focused ? 'red' : color}}>Settings</Text>
          ),
          tabBarIcon: ({color, size}) => (
            <MaterialCommunityIcons
              name="account-settings"
              color={color}
              size={size}
            />
          ),
        }}
        name="Settings"
        component={SettingsScreen}
      />
    </Tab.Navigator>
  )
}
-----------------------
options={{
  tabBarLabel: ({focused, color, size}) => (
    <Text style={{color: focused ? 'red' : color}}>Updates</Text>
  ),
}}
const Tab = createBottomTabNavigator();
function MyTabs() {
  return (
    <Tab.Navigator>
      <Tab.Screen
        options={{
          tabBarLabel: ({focused, color, size}) => (
            <Text style={{color: focused ? 'red' : color}}>Updates</Text>
          ),
          tabBarIcon: ({color, size}) => (
            <MaterialCommunityIcons name="bell" color={color} size={size} />
          ),
        }}
        name="Home"
        component={HomeScreen}
      />
      <Tab.Screen
        options={{
          tabBarLabel: ({focused, color, size}) => (
            <Text style={{color: focused ? 'red' : color}}>Settings</Text>
          ),
          tabBarIcon: ({color, size}) => (
            <MaterialCommunityIcons
              name="account-settings"
              color={color}
              size={size}
            />
          ),
        }}
        name="Settings"
        component={SettingsScreen}
      />
    </Tab.Navigator>
  )
}
-----------------------
options={{
  tabBarLabel: ({focused, color, size}) => (
    <Text style={{color: focused ? 'red' : color}}>Updates</Text>
  ),
}}
const Tab = createBottomTabNavigator();
function MyTabs() {
  return (
    <Tab.Navigator>
      <Tab.Screen
        options={{
          tabBarLabel: ({focused, color, size}) => (
            <Text style={{color: focused ? 'red' : color}}>Updates</Text>
          ),
          tabBarIcon: ({color, size}) => (
            <MaterialCommunityIcons name="bell" color={color} size={size} />
          ),
        }}
        name="Home"
        component={HomeScreen}
      />
      <Tab.Screen
        options={{
          tabBarLabel: ({focused, color, size}) => (
            <Text style={{color: focused ? 'red' : color}}>Settings</Text>
          ),
          tabBarIcon: ({color, size}) => (
            <MaterialCommunityIcons
              name="account-settings"
              color={color}
              size={size}
            />
          ),
        }}
        name="Settings"
        component={SettingsScreen}
      />
    </Tab.Navigator>
  )
}

Javascript validate all checkboxes are selected

copy iconCopydownload iconDownload
termsCheckBox.closest('form').querySelectorAll("input[type=checkbox]:checked")
document.getElementById("grid").querySelectorAll("input[type=checkbox]:checked")
document.getElementsByClassName("selectall")[0].style.display = "block";
document.getElementsByClassName("hideall")[0].style.display = "none";
const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";     
function chk(termsCheckBox){
    const grid = document.getElementById("grid");
    document.getElementById("attend").disabled = !grid.querySelectorAll("input[type=checkbox]:checked").length;
    if(document.getElementById("attend").disabled) {
        document.getElementById("attend").classList.remove("green-btn");
        document.getElementById("attend").classList.add("grey-btn");
        document.getElementById("action").classList.remove("green-btn");
        document.getElementById("action").classList.add("grey-btn");
        document.getElementById("random").classList.add("green-btn");
        document.getElementById("random").classList.remove("grey-btn");
    } 
    else {
        document.getElementById("attend").classList.add("green-btn");
        document.getElementById("attend").classList.remove("grey-btn");
        document.getElementById("action").classList.add("green-btn");
        document.getElementById("action").classList.remove("grey-btn");
        document.getElementById("random").classList.remove("green-btn");
        document.getElementById("random").classList.add("grey-btn");
    }
    const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
    document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
    document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";      
}

// Below this line is not verified to work yet //

function selectAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = true;
    }
    document.getElementsByClassName("selectall")[0].style.display = "none";
    document.getElementsByClassName("hideall")[0].style.display = "block";
}

function hideAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = false;
    }
    document.getElementsByClassName("selectall")[0].style.display = "block";
    document.getElementsByClassName("hideall")[0].style.display = "none";
}
#grid {
  margin: 20px;
  display: grid;
  grid-gap: 20px;}

.tile {
  width: 125px; height: 165px;
  font-size: 0.9rem;
  background-color: white;
  border-radius: 4%;
  overflow: hidden;
  text-align: center;
  box-shadow: 3px 4px #CECECE}
  .tile img{max-width: 100%; max-height: 100%; display: block;}
  .tile:hover {background-color: #C2CBB9; box-shadow: 3px 4px #9E999E; cursor: grab; transform: scale(1.05);}

.absent {filter: grayscale(100%); color: gray;}

.tile_pic{
  width: 125px;
  height: 125px;
  object-fit: cover;}

.tile_title {
  margin-top: 10px;
  font-family: 'Rubik', sans-serif;}

#grid input[type=checkbox] {display: none;}
#grid input:checked + label .tile{background-color: #A3B195; box-shadow: 3px 4px #9E999E}

@media (min-width: 430px) {#grid { grid-template-columns: repeat(5, 1fr); }}
@media (min-width: 660px) {#grid { grid-template-columns: repeat(6, 1fr); }}
@media (min-width: 890px) {#grid { grid-template-columns: repeat(7, 1fr); }}
@media (min-width: 1120px) {#grid { grid-template-columns: repeat(8, 1fr); }}
@media (min-width: 1350px) {#grid { grid-template-columns: repeat(9, 1fr); }}
@media (min-width: 1580px) {#grid { grid-template-columns: repeat(10, 1fr); }}




/* Begin editing below here */
body {background-color: #F2F2F2;}

#content {
  position: absolute;
  width: 100vw; height: calc(100vh - 120px);
  top: 60px; left: 0;
  padding-top: 30px}

#bottombar {
  position: fixed;
  width: 100vw; height: 60px;
  bottom: 0; left: 0;
  padding: 4px;
  box-sizing: border-box;
  border-top: 2px solid darkgray;
  background-color: white;}

.right{float: right;}
.left{float: left;}

#bottombar ul{
  margin: 0;
  padding: 0;
  list-style-type: none}
  #bottombar li{float: left}

.selectall, .hideall {font-size: 20px; padding: 11px}

/* Customizes the global button design */
#bottombar .button {
  padding: 8px 24px;
  margin-right: 8px;
  font-size: 18px;
  border-radius: 26px}
<link rel="stylesheet" href="https://classcolonies.com/resources/style.css">

<div id='content'>
  <form id='grid'>
    <input type='checkbox' name='upid[]' id='292' value='292' onclick='chk(this);'>
    <label for='292'>
      <div class='tile absent'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/default.png'>
        <div class='tile_title'><b>Charlie</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='306' value='306' onclick='chk(this);'>
    <label for='306'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/68.jpg'>
        <div class='tile_title'><b>Marshall</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='107' value='107' onclick='chk(this);'>
    <label for='107'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/59.jpg'>
        <div class='tile_title'><b>Addix</b></div>
      </div>
    </label>
  </form>
</div>


<div id='bottombar'>
  
  <ul class="left">
    <li><a class="selectall" onclick='selectAll(); chk(this);'>Select All</a></li>
    <li><a class="hideall" style='display:none' onclick='hideAll(); chk(this);'>Select None</a></li>
  </ul>
  
  <ul class="right">
    <li><button id='attend' class="button grey-btn" disabled>Attendance</button></li>
    <li><button id='action' class="button grey-btn" disabled>Action</button></li>
    <li><button id='random' class="button green-btn">Random</button></li>
  </ul>

</div>
let condition = document.getElementById("attend").disabled;
document.getElementById("attend").classList.toogle("green-btn", !condition); // remove when condition is true, add when condition is false
document.getElementById("attend").classList.toogle("grey-btn", condition); // remove when condition is false, add when condition is true
-----------------------
termsCheckBox.closest('form').querySelectorAll("input[type=checkbox]:checked")
document.getElementById("grid").querySelectorAll("input[type=checkbox]:checked")
document.getElementsByClassName("selectall")[0].style.display = "block";
document.getElementsByClassName("hideall")[0].style.display = "none";
const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";     
function chk(termsCheckBox){
    const grid = document.getElementById("grid");
    document.getElementById("attend").disabled = !grid.querySelectorAll("input[type=checkbox]:checked").length;
    if(document.getElementById("attend").disabled) {
        document.getElementById("attend").classList.remove("green-btn");
        document.getElementById("attend").classList.add("grey-btn");
        document.getElementById("action").classList.remove("green-btn");
        document.getElementById("action").classList.add("grey-btn");
        document.getElementById("random").classList.add("green-btn");
        document.getElementById("random").classList.remove("grey-btn");
    } 
    else {
        document.getElementById("attend").classList.add("green-btn");
        document.getElementById("attend").classList.remove("grey-btn");
        document.getElementById("action").classList.add("green-btn");
        document.getElementById("action").classList.remove("grey-btn");
        document.getElementById("random").classList.remove("green-btn");
        document.getElementById("random").classList.add("grey-btn");
    }
    const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
    document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
    document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";      
}

// Below this line is not verified to work yet //

function selectAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = true;
    }
    document.getElementsByClassName("selectall")[0].style.display = "none";
    document.getElementsByClassName("hideall")[0].style.display = "block";
}

function hideAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = false;
    }
    document.getElementsByClassName("selectall")[0].style.display = "block";
    document.getElementsByClassName("hideall")[0].style.display = "none";
}
#grid {
  margin: 20px;
  display: grid;
  grid-gap: 20px;}

.tile {
  width: 125px; height: 165px;
  font-size: 0.9rem;
  background-color: white;
  border-radius: 4%;
  overflow: hidden;
  text-align: center;
  box-shadow: 3px 4px #CECECE}
  .tile img{max-width: 100%; max-height: 100%; display: block;}
  .tile:hover {background-color: #C2CBB9; box-shadow: 3px 4px #9E999E; cursor: grab; transform: scale(1.05);}

.absent {filter: grayscale(100%); color: gray;}

.tile_pic{
  width: 125px;
  height: 125px;
  object-fit: cover;}

.tile_title {
  margin-top: 10px;
  font-family: 'Rubik', sans-serif;}

#grid input[type=checkbox] {display: none;}
#grid input:checked + label .tile{background-color: #A3B195; box-shadow: 3px 4px #9E999E}

@media (min-width: 430px) {#grid { grid-template-columns: repeat(5, 1fr); }}
@media (min-width: 660px) {#grid { grid-template-columns: repeat(6, 1fr); }}
@media (min-width: 890px) {#grid { grid-template-columns: repeat(7, 1fr); }}
@media (min-width: 1120px) {#grid { grid-template-columns: repeat(8, 1fr); }}
@media (min-width: 1350px) {#grid { grid-template-columns: repeat(9, 1fr); }}
@media (min-width: 1580px) {#grid { grid-template-columns: repeat(10, 1fr); }}




/* Begin editing below here */
body {background-color: #F2F2F2;}

#content {
  position: absolute;
  width: 100vw; height: calc(100vh - 120px);
  top: 60px; left: 0;
  padding-top: 30px}

#bottombar {
  position: fixed;
  width: 100vw; height: 60px;
  bottom: 0; left: 0;
  padding: 4px;
  box-sizing: border-box;
  border-top: 2px solid darkgray;
  background-color: white;}

.right{float: right;}
.left{float: left;}

#bottombar ul{
  margin: 0;
  padding: 0;
  list-style-type: none}
  #bottombar li{float: left}

.selectall, .hideall {font-size: 20px; padding: 11px}

/* Customizes the global button design */
#bottombar .button {
  padding: 8px 24px;
  margin-right: 8px;
  font-size: 18px;
  border-radius: 26px}
<link rel="stylesheet" href="https://classcolonies.com/resources/style.css">

<div id='content'>
  <form id='grid'>
    <input type='checkbox' name='upid[]' id='292' value='292' onclick='chk(this);'>
    <label for='292'>
      <div class='tile absent'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/default.png'>
        <div class='tile_title'><b>Charlie</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='306' value='306' onclick='chk(this);'>
    <label for='306'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/68.jpg'>
        <div class='tile_title'><b>Marshall</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='107' value='107' onclick='chk(this);'>
    <label for='107'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/59.jpg'>
        <div class='tile_title'><b>Addix</b></div>
      </div>
    </label>
  </form>
</div>


<div id='bottombar'>
  
  <ul class="left">
    <li><a class="selectall" onclick='selectAll(); chk(this);'>Select All</a></li>
    <li><a class="hideall" style='display:none' onclick='hideAll(); chk(this);'>Select None</a></li>
  </ul>
  
  <ul class="right">
    <li><button id='attend' class="button grey-btn" disabled>Attendance</button></li>
    <li><button id='action' class="button grey-btn" disabled>Action</button></li>
    <li><button id='random' class="button green-btn">Random</button></li>
  </ul>

</div>
let condition = document.getElementById("attend").disabled;
document.getElementById("attend").classList.toogle("green-btn", !condition); // remove when condition is true, add when condition is false
document.getElementById("attend").classList.toogle("grey-btn", condition); // remove when condition is false, add when condition is true
-----------------------
termsCheckBox.closest('form').querySelectorAll("input[type=checkbox]:checked")
document.getElementById("grid").querySelectorAll("input[type=checkbox]:checked")
document.getElementsByClassName("selectall")[0].style.display = "block";
document.getElementsByClassName("hideall")[0].style.display = "none";
const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";     
function chk(termsCheckBox){
    const grid = document.getElementById("grid");
    document.getElementById("attend").disabled = !grid.querySelectorAll("input[type=checkbox]:checked").length;
    if(document.getElementById("attend").disabled) {
        document.getElementById("attend").classList.remove("green-btn");
        document.getElementById("attend").classList.add("grey-btn");
        document.getElementById("action").classList.remove("green-btn");
        document.getElementById("action").classList.add("grey-btn");
        document.getElementById("random").classList.add("green-btn");
        document.getElementById("random").classList.remove("grey-btn");
    } 
    else {
        document.getElementById("attend").classList.add("green-btn");
        document.getElementById("attend").classList.remove("grey-btn");
        document.getElementById("action").classList.add("green-btn");
        document.getElementById("action").classList.remove("grey-btn");
        document.getElementById("random").classList.remove("green-btn");
        document.getElementById("random").classList.add("grey-btn");
    }
    const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
    document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
    document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";      
}

// Below this line is not verified to work yet //

function selectAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = true;
    }
    document.getElementsByClassName("selectall")[0].style.display = "none";
    document.getElementsByClassName("hideall")[0].style.display = "block";
}

function hideAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = false;
    }
    document.getElementsByClassName("selectall")[0].style.display = "block";
    document.getElementsByClassName("hideall")[0].style.display = "none";
}
#grid {
  margin: 20px;
  display: grid;
  grid-gap: 20px;}

.tile {
  width: 125px; height: 165px;
  font-size: 0.9rem;
  background-color: white;
  border-radius: 4%;
  overflow: hidden;
  text-align: center;
  box-shadow: 3px 4px #CECECE}
  .tile img{max-width: 100%; max-height: 100%; display: block;}
  .tile:hover {background-color: #C2CBB9; box-shadow: 3px 4px #9E999E; cursor: grab; transform: scale(1.05);}

.absent {filter: grayscale(100%); color: gray;}

.tile_pic{
  width: 125px;
  height: 125px;
  object-fit: cover;}

.tile_title {
  margin-top: 10px;
  font-family: 'Rubik', sans-serif;}

#grid input[type=checkbox] {display: none;}
#grid input:checked + label .tile{background-color: #A3B195; box-shadow: 3px 4px #9E999E}

@media (min-width: 430px) {#grid { grid-template-columns: repeat(5, 1fr); }}
@media (min-width: 660px) {#grid { grid-template-columns: repeat(6, 1fr); }}
@media (min-width: 890px) {#grid { grid-template-columns: repeat(7, 1fr); }}
@media (min-width: 1120px) {#grid { grid-template-columns: repeat(8, 1fr); }}
@media (min-width: 1350px) {#grid { grid-template-columns: repeat(9, 1fr); }}
@media (min-width: 1580px) {#grid { grid-template-columns: repeat(10, 1fr); }}




/* Begin editing below here */
body {background-color: #F2F2F2;}

#content {
  position: absolute;
  width: 100vw; height: calc(100vh - 120px);
  top: 60px; left: 0;
  padding-top: 30px}

#bottombar {
  position: fixed;
  width: 100vw; height: 60px;
  bottom: 0; left: 0;
  padding: 4px;
  box-sizing: border-box;
  border-top: 2px solid darkgray;
  background-color: white;}

.right{float: right;}
.left{float: left;}

#bottombar ul{
  margin: 0;
  padding: 0;
  list-style-type: none}
  #bottombar li{float: left}

.selectall, .hideall {font-size: 20px; padding: 11px}

/* Customizes the global button design */
#bottombar .button {
  padding: 8px 24px;
  margin-right: 8px;
  font-size: 18px;
  border-radius: 26px}
<link rel="stylesheet" href="https://classcolonies.com/resources/style.css">

<div id='content'>
  <form id='grid'>
    <input type='checkbox' name='upid[]' id='292' value='292' onclick='chk(this);'>
    <label for='292'>
      <div class='tile absent'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/default.png'>
        <div class='tile_title'><b>Charlie</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='306' value='306' onclick='chk(this);'>
    <label for='306'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/68.jpg'>
        <div class='tile_title'><b>Marshall</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='107' value='107' onclick='chk(this);'>
    <label for='107'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/59.jpg'>
        <div class='tile_title'><b>Addix</b></div>
      </div>
    </label>
  </form>
</div>


<div id='bottombar'>
  
  <ul class="left">
    <li><a class="selectall" onclick='selectAll(); chk(this);'>Select All</a></li>
    <li><a class="hideall" style='display:none' onclick='hideAll(); chk(this);'>Select None</a></li>
  </ul>
  
  <ul class="right">
    <li><button id='attend' class="button grey-btn" disabled>Attendance</button></li>
    <li><button id='action' class="button grey-btn" disabled>Action</button></li>
    <li><button id='random' class="button green-btn">Random</button></li>
  </ul>

</div>
let condition = document.getElementById("attend").disabled;
document.getElementById("attend").classList.toogle("green-btn", !condition); // remove when condition is true, add when condition is false
document.getElementById("attend").classList.toogle("grey-btn", condition); // remove when condition is false, add when condition is true
-----------------------
termsCheckBox.closest('form').querySelectorAll("input[type=checkbox]:checked")
document.getElementById("grid").querySelectorAll("input[type=checkbox]:checked")
document.getElementsByClassName("selectall")[0].style.display = "block";
document.getElementsByClassName("hideall")[0].style.display = "none";
const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";     
function chk(termsCheckBox){
    const grid = document.getElementById("grid");
    document.getElementById("attend").disabled = !grid.querySelectorAll("input[type=checkbox]:checked").length;
    if(document.getElementById("attend").disabled) {
        document.getElementById("attend").classList.remove("green-btn");
        document.getElementById("attend").classList.add("grey-btn");
        document.getElementById("action").classList.remove("green-btn");
        document.getElementById("action").classList.add("grey-btn");
        document.getElementById("random").classList.add("green-btn");
        document.getElementById("random").classList.remove("grey-btn");
    } 
    else {
        document.getElementById("attend").classList.add("green-btn");
        document.getElementById("attend").classList.remove("grey-btn");
        document.getElementById("action").classList.add("green-btn");
        document.getElementById("action").classList.remove("grey-btn");
        document.getElementById("random").classList.remove("green-btn");
        document.getElementById("random").classList.add("grey-btn");
    }
    const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
    document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
    document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";      
}

// Below this line is not verified to work yet //

function selectAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = true;
    }
    document.getElementsByClassName("selectall")[0].style.display = "none";
    document.getElementsByClassName("hideall")[0].style.display = "block";
}

function hideAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = false;
    }
    document.getElementsByClassName("selectall")[0].style.display = "block";
    document.getElementsByClassName("hideall")[0].style.display = "none";
}
#grid {
  margin: 20px;
  display: grid;
  grid-gap: 20px;}

.tile {
  width: 125px; height: 165px;
  font-size: 0.9rem;
  background-color: white;
  border-radius: 4%;
  overflow: hidden;
  text-align: center;
  box-shadow: 3px 4px #CECECE}
  .tile img{max-width: 100%; max-height: 100%; display: block;}
  .tile:hover {background-color: #C2CBB9; box-shadow: 3px 4px #9E999E; cursor: grab; transform: scale(1.05);}

.absent {filter: grayscale(100%); color: gray;}

.tile_pic{
  width: 125px;
  height: 125px;
  object-fit: cover;}

.tile_title {
  margin-top: 10px;
  font-family: 'Rubik', sans-serif;}

#grid input[type=checkbox] {display: none;}
#grid input:checked + label .tile{background-color: #A3B195; box-shadow: 3px 4px #9E999E}

@media (min-width: 430px) {#grid { grid-template-columns: repeat(5, 1fr); }}
@media (min-width: 660px) {#grid { grid-template-columns: repeat(6, 1fr); }}
@media (min-width: 890px) {#grid { grid-template-columns: repeat(7, 1fr); }}
@media (min-width: 1120px) {#grid { grid-template-columns: repeat(8, 1fr); }}
@media (min-width: 1350px) {#grid { grid-template-columns: repeat(9, 1fr); }}
@media (min-width: 1580px) {#grid { grid-template-columns: repeat(10, 1fr); }}




/* Begin editing below here */
body {background-color: #F2F2F2;}

#content {
  position: absolute;
  width: 100vw; height: calc(100vh - 120px);
  top: 60px; left: 0;
  padding-top: 30px}

#bottombar {
  position: fixed;
  width: 100vw; height: 60px;
  bottom: 0; left: 0;
  padding: 4px;
  box-sizing: border-box;
  border-top: 2px solid darkgray;
  background-color: white;}

.right{float: right;}
.left{float: left;}

#bottombar ul{
  margin: 0;
  padding: 0;
  list-style-type: none}
  #bottombar li{float: left}

.selectall, .hideall {font-size: 20px; padding: 11px}

/* Customizes the global button design */
#bottombar .button {
  padding: 8px 24px;
  margin-right: 8px;
  font-size: 18px;
  border-radius: 26px}
<link rel="stylesheet" href="https://classcolonies.com/resources/style.css">

<div id='content'>
  <form id='grid'>
    <input type='checkbox' name='upid[]' id='292' value='292' onclick='chk(this);'>
    <label for='292'>
      <div class='tile absent'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/default.png'>
        <div class='tile_title'><b>Charlie</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='306' value='306' onclick='chk(this);'>
    <label for='306'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/68.jpg'>
        <div class='tile_title'><b>Marshall</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='107' value='107' onclick='chk(this);'>
    <label for='107'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/59.jpg'>
        <div class='tile_title'><b>Addix</b></div>
      </div>
    </label>
  </form>
</div>


<div id='bottombar'>
  
  <ul class="left">
    <li><a class="selectall" onclick='selectAll(); chk(this);'>Select All</a></li>
    <li><a class="hideall" style='display:none' onclick='hideAll(); chk(this);'>Select None</a></li>
  </ul>
  
  <ul class="right">
    <li><button id='attend' class="button grey-btn" disabled>Attendance</button></li>
    <li><button id='action' class="button grey-btn" disabled>Action</button></li>
    <li><button id='random' class="button green-btn">Random</button></li>
  </ul>

</div>
let condition = document.getElementById("attend").disabled;
document.getElementById("attend").classList.toogle("green-btn", !condition); // remove when condition is true, add when condition is false
document.getElementById("attend").classList.toogle("grey-btn", condition); // remove when condition is false, add when condition is true
-----------------------
termsCheckBox.closest('form').querySelectorAll("input[type=checkbox]:checked")
document.getElementById("grid").querySelectorAll("input[type=checkbox]:checked")
document.getElementsByClassName("selectall")[0].style.display = "block";
document.getElementsByClassName("hideall")[0].style.display = "none";
const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";     
function chk(termsCheckBox){
    const grid = document.getElementById("grid");
    document.getElementById("attend").disabled = !grid.querySelectorAll("input[type=checkbox]:checked").length;
    if(document.getElementById("attend").disabled) {
        document.getElementById("attend").classList.remove("green-btn");
        document.getElementById("attend").classList.add("grey-btn");
        document.getElementById("action").classList.remove("green-btn");
        document.getElementById("action").classList.add("grey-btn");
        document.getElementById("random").classList.add("green-btn");
        document.getElementById("random").classList.remove("grey-btn");
    } 
    else {
        document.getElementById("attend").classList.add("green-btn");
        document.getElementById("attend").classList.remove("grey-btn");
        document.getElementById("action").classList.add("green-btn");
        document.getElementById("action").classList.remove("grey-btn");
        document.getElementById("random").classList.remove("green-btn");
        document.getElementById("random").classList.add("grey-btn");
    }
    const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
    document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
    document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";      
}

// Below this line is not verified to work yet //

function selectAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = true;
    }
    document.getElementsByClassName("selectall")[0].style.display = "none";
    document.getElementsByClassName("hideall")[0].style.display = "block";
}

function hideAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = false;
    }
    document.getElementsByClassName("selectall")[0].style.display = "block";
    document.getElementsByClassName("hideall")[0].style.display = "none";
}
#grid {
  margin: 20px;
  display: grid;
  grid-gap: 20px;}

.tile {
  width: 125px; height: 165px;
  font-size: 0.9rem;
  background-color: white;
  border-radius: 4%;
  overflow: hidden;
  text-align: center;
  box-shadow: 3px 4px #CECECE}
  .tile img{max-width: 100%; max-height: 100%; display: block;}
  .tile:hover {background-color: #C2CBB9; box-shadow: 3px 4px #9E999E; cursor: grab; transform: scale(1.05);}

.absent {filter: grayscale(100%); color: gray;}

.tile_pic{
  width: 125px;
  height: 125px;
  object-fit: cover;}

.tile_title {
  margin-top: 10px;
  font-family: 'Rubik', sans-serif;}

#grid input[type=checkbox] {display: none;}
#grid input:checked + label .tile{background-color: #A3B195; box-shadow: 3px 4px #9E999E}

@media (min-width: 430px) {#grid { grid-template-columns: repeat(5, 1fr); }}
@media (min-width: 660px) {#grid { grid-template-columns: repeat(6, 1fr); }}
@media (min-width: 890px) {#grid { grid-template-columns: repeat(7, 1fr); }}
@media (min-width: 1120px) {#grid { grid-template-columns: repeat(8, 1fr); }}
@media (min-width: 1350px) {#grid { grid-template-columns: repeat(9, 1fr); }}
@media (min-width: 1580px) {#grid { grid-template-columns: repeat(10, 1fr); }}




/* Begin editing below here */
body {background-color: #F2F2F2;}

#content {
  position: absolute;
  width: 100vw; height: calc(100vh - 120px);
  top: 60px; left: 0;
  padding-top: 30px}

#bottombar {
  position: fixed;
  width: 100vw; height: 60px;
  bottom: 0; left: 0;
  padding: 4px;
  box-sizing: border-box;
  border-top: 2px solid darkgray;
  background-color: white;}

.right{float: right;}
.left{float: left;}

#bottombar ul{
  margin: 0;
  padding: 0;
  list-style-type: none}
  #bottombar li{float: left}

.selectall, .hideall {font-size: 20px; padding: 11px}

/* Customizes the global button design */
#bottombar .button {
  padding: 8px 24px;
  margin-right: 8px;
  font-size: 18px;
  border-radius: 26px}
<link rel="stylesheet" href="https://classcolonies.com/resources/style.css">

<div id='content'>
  <form id='grid'>
    <input type='checkbox' name='upid[]' id='292' value='292' onclick='chk(this);'>
    <label for='292'>
      <div class='tile absent'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/default.png'>
        <div class='tile_title'><b>Charlie</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='306' value='306' onclick='chk(this);'>
    <label for='306'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/68.jpg'>
        <div class='tile_title'><b>Marshall</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='107' value='107' onclick='chk(this);'>
    <label for='107'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/59.jpg'>
        <div class='tile_title'><b>Addix</b></div>
      </div>
    </label>
  </form>
</div>


<div id='bottombar'>
  
  <ul class="left">
    <li><a class="selectall" onclick='selectAll(); chk(this);'>Select All</a></li>
    <li><a class="hideall" style='display:none' onclick='hideAll(); chk(this);'>Select None</a></li>
  </ul>
  
  <ul class="right">
    <li><button id='attend' class="button grey-btn" disabled>Attendance</button></li>
    <li><button id='action' class="button grey-btn" disabled>Action</button></li>
    <li><button id='random' class="button green-btn">Random</button></li>
  </ul>

</div>
let condition = document.getElementById("attend").disabled;
document.getElementById("attend").classList.toogle("green-btn", !condition); // remove when condition is true, add when condition is false
document.getElementById("attend").classList.toogle("grey-btn", condition); // remove when condition is false, add when condition is true
-----------------------
termsCheckBox.closest('form').querySelectorAll("input[type=checkbox]:checked")
document.getElementById("grid").querySelectorAll("input[type=checkbox]:checked")
document.getElementsByClassName("selectall")[0].style.display = "block";
document.getElementsByClassName("hideall")[0].style.display = "none";
const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";     
function chk(termsCheckBox){
    const grid = document.getElementById("grid");
    document.getElementById("attend").disabled = !grid.querySelectorAll("input[type=checkbox]:checked").length;
    if(document.getElementById("attend").disabled) {
        document.getElementById("attend").classList.remove("green-btn");
        document.getElementById("attend").classList.add("grey-btn");
        document.getElementById("action").classList.remove("green-btn");
        document.getElementById("action").classList.add("grey-btn");
        document.getElementById("random").classList.add("green-btn");
        document.getElementById("random").classList.remove("grey-btn");
    } 
    else {
        document.getElementById("attend").classList.add("green-btn");
        document.getElementById("attend").classList.remove("grey-btn");
        document.getElementById("action").classList.add("green-btn");
        document.getElementById("action").classList.remove("grey-btn");
        document.getElementById("random").classList.remove("green-btn");
        document.getElementById("random").classList.add("grey-btn");
    }
    const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
    document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
    document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";      
}

// Below this line is not verified to work yet //

function selectAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = true;
    }
    document.getElementsByClassName("selectall")[0].style.display = "none";
    document.getElementsByClassName("hideall")[0].style.display = "block";
}

function hideAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = false;
    }
    document.getElementsByClassName("selectall")[0].style.display = "block";
    document.getElementsByClassName("hideall")[0].style.display = "none";
}
#grid {
  margin: 20px;
  display: grid;
  grid-gap: 20px;}

.tile {
  width: 125px; height: 165px;
  font-size: 0.9rem;
  background-color: white;
  border-radius: 4%;
  overflow: hidden;
  text-align: center;
  box-shadow: 3px 4px #CECECE}
  .tile img{max-width: 100%; max-height: 100%; display: block;}
  .tile:hover {background-color: #C2CBB9; box-shadow: 3px 4px #9E999E; cursor: grab; transform: scale(1.05);}

.absent {filter: grayscale(100%); color: gray;}

.tile_pic{
  width: 125px;
  height: 125px;
  object-fit: cover;}

.tile_title {
  margin-top: 10px;
  font-family: 'Rubik', sans-serif;}

#grid input[type=checkbox] {display: none;}
#grid input:checked + label .tile{background-color: #A3B195; box-shadow: 3px 4px #9E999E}

@media (min-width: 430px) {#grid { grid-template-columns: repeat(5, 1fr); }}
@media (min-width: 660px) {#grid { grid-template-columns: repeat(6, 1fr); }}
@media (min-width: 890px) {#grid { grid-template-columns: repeat(7, 1fr); }}
@media (min-width: 1120px) {#grid { grid-template-columns: repeat(8, 1fr); }}
@media (min-width: 1350px) {#grid { grid-template-columns: repeat(9, 1fr); }}
@media (min-width: 1580px) {#grid { grid-template-columns: repeat(10, 1fr); }}




/* Begin editing below here */
body {background-color: #F2F2F2;}

#content {
  position: absolute;
  width: 100vw; height: calc(100vh - 120px);
  top: 60px; left: 0;
  padding-top: 30px}

#bottombar {
  position: fixed;
  width: 100vw; height: 60px;
  bottom: 0; left: 0;
  padding: 4px;
  box-sizing: border-box;
  border-top: 2px solid darkgray;
  background-color: white;}

.right{float: right;}
.left{float: left;}

#bottombar ul{
  margin: 0;
  padding: 0;
  list-style-type: none}
  #bottombar li{float: left}

.selectall, .hideall {font-size: 20px; padding: 11px}

/* Customizes the global button design */
#bottombar .button {
  padding: 8px 24px;
  margin-right: 8px;
  font-size: 18px;
  border-radius: 26px}
<link rel="stylesheet" href="https://classcolonies.com/resources/style.css">

<div id='content'>
  <form id='grid'>
    <input type='checkbox' name='upid[]' id='292' value='292' onclick='chk(this);'>
    <label for='292'>
      <div class='tile absent'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/default.png'>
        <div class='tile_title'><b>Charlie</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='306' value='306' onclick='chk(this);'>
    <label for='306'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/68.jpg'>
        <div class='tile_title'><b>Marshall</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='107' value='107' onclick='chk(this);'>
    <label for='107'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/59.jpg'>
        <div class='tile_title'><b>Addix</b></div>
      </div>
    </label>
  </form>
</div>


<div id='bottombar'>
  
  <ul class="left">
    <li><a class="selectall" onclick='selectAll(); chk(this);'>Select All</a></li>
    <li><a class="hideall" style='display:none' onclick='hideAll(); chk(this);'>Select None</a></li>
  </ul>
  
  <ul class="right">
    <li><button id='attend' class="button grey-btn" disabled>Attendance</button></li>
    <li><button id='action' class="button grey-btn" disabled>Action</button></li>
    <li><button id='random' class="button green-btn">Random</button></li>
  </ul>

</div>
let condition = document.getElementById("attend").disabled;
document.getElementById("attend").classList.toogle("green-btn", !condition); // remove when condition is true, add when condition is false
document.getElementById("attend").classList.toogle("grey-btn", condition); // remove when condition is false, add when condition is true
-----------------------
termsCheckBox.closest('form').querySelectorAll("input[type=checkbox]:checked")
document.getElementById("grid").querySelectorAll("input[type=checkbox]:checked")
document.getElementsByClassName("selectall")[0].style.display = "block";
document.getElementsByClassName("hideall")[0].style.display = "none";
const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";     
function chk(termsCheckBox){
    const grid = document.getElementById("grid");
    document.getElementById("attend").disabled = !grid.querySelectorAll("input[type=checkbox]:checked").length;
    if(document.getElementById("attend").disabled) {
        document.getElementById("attend").classList.remove("green-btn");
        document.getElementById("attend").classList.add("grey-btn");
        document.getElementById("action").classList.remove("green-btn");
        document.getElementById("action").classList.add("grey-btn");
        document.getElementById("random").classList.add("green-btn");
        document.getElementById("random").classList.remove("grey-btn");
    } 
    else {
        document.getElementById("attend").classList.add("green-btn");
        document.getElementById("attend").classList.remove("grey-btn");
        document.getElementById("action").classList.add("green-btn");
        document.getElementById("action").classList.remove("grey-btn");
        document.getElementById("random").classList.remove("green-btn");
        document.getElementById("random").classList.add("grey-btn");
    }
    const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
    document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
    document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";      
}

// Below this line is not verified to work yet //

function selectAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = true;
    }
    document.getElementsByClassName("selectall")[0].style.display = "none";
    document.getElementsByClassName("hideall")[0].style.display = "block";
}

function hideAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = false;
    }
    document.getElementsByClassName("selectall")[0].style.display = "block";
    document.getElementsByClassName("hideall")[0].style.display = "none";
}
#grid {
  margin: 20px;
  display: grid;
  grid-gap: 20px;}

.tile {
  width: 125px; height: 165px;
  font-size: 0.9rem;
  background-color: white;
  border-radius: 4%;
  overflow: hidden;
  text-align: center;
  box-shadow: 3px 4px #CECECE}
  .tile img{max-width: 100%; max-height: 100%; display: block;}
  .tile:hover {background-color: #C2CBB9; box-shadow: 3px 4px #9E999E; cursor: grab; transform: scale(1.05);}

.absent {filter: grayscale(100%); color: gray;}

.tile_pic{
  width: 125px;
  height: 125px;
  object-fit: cover;}

.tile_title {
  margin-top: 10px;
  font-family: 'Rubik', sans-serif;}

#grid input[type=checkbox] {display: none;}
#grid input:checked + label .tile{background-color: #A3B195; box-shadow: 3px 4px #9E999E}

@media (min-width: 430px) {#grid { grid-template-columns: repeat(5, 1fr); }}
@media (min-width: 660px) {#grid { grid-template-columns: repeat(6, 1fr); }}
@media (min-width: 890px) {#grid { grid-template-columns: repeat(7, 1fr); }}
@media (min-width: 1120px) {#grid { grid-template-columns: repeat(8, 1fr); }}
@media (min-width: 1350px) {#grid { grid-template-columns: repeat(9, 1fr); }}
@media (min-width: 1580px) {#grid { grid-template-columns: repeat(10, 1fr); }}




/* Begin editing below here */
body {background-color: #F2F2F2;}

#content {
  position: absolute;
  width: 100vw; height: calc(100vh - 120px);
  top: 60px; left: 0;
  padding-top: 30px}

#bottombar {
  position: fixed;
  width: 100vw; height: 60px;
  bottom: 0; left: 0;
  padding: 4px;
  box-sizing: border-box;
  border-top: 2px solid darkgray;
  background-color: white;}

.right{float: right;}
.left{float: left;}

#bottombar ul{
  margin: 0;
  padding: 0;
  list-style-type: none}
  #bottombar li{float: left}

.selectall, .hideall {font-size: 20px; padding: 11px}

/* Customizes the global button design */
#bottombar .button {
  padding: 8px 24px;
  margin-right: 8px;
  font-size: 18px;
  border-radius: 26px}
<link rel="stylesheet" href="https://classcolonies.com/resources/style.css">

<div id='content'>
  <form id='grid'>
    <input type='checkbox' name='upid[]' id='292' value='292' onclick='chk(this);'>
    <label for='292'>
      <div class='tile absent'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/default.png'>
        <div class='tile_title'><b>Charlie</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='306' value='306' onclick='chk(this);'>
    <label for='306'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/68.jpg'>
        <div class='tile_title'><b>Marshall</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='107' value='107' onclick='chk(this);'>
    <label for='107'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/59.jpg'>
        <div class='tile_title'><b>Addix</b></div>
      </div>
    </label>
  </form>
</div>


<div id='bottombar'>
  
  <ul class="left">
    <li><a class="selectall" onclick='selectAll(); chk(this);'>Select All</a></li>
    <li><a class="hideall" style='display:none' onclick='hideAll(); chk(this);'>Select None</a></li>
  </ul>
  
  <ul class="right">
    <li><button id='attend' class="button grey-btn" disabled>Attendance</button></li>
    <li><button id='action' class="button grey-btn" disabled>Action</button></li>
    <li><button id='random' class="button green-btn">Random</button></li>
  </ul>

</div>
let condition = document.getElementById("attend").disabled;
document.getElementById("attend").classList.toogle("green-btn", !condition); // remove when condition is true, add when condition is false
document.getElementById("attend").classList.toogle("grey-btn", condition); // remove when condition is false, add when condition is true
-----------------------
termsCheckBox.closest('form').querySelectorAll("input[type=checkbox]:checked")
document.getElementById("grid").querySelectorAll("input[type=checkbox]:checked")
document.getElementsByClassName("selectall")[0].style.display = "block";
document.getElementsByClassName("hideall")[0].style.display = "none";
const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";     
function chk(termsCheckBox){
    const grid = document.getElementById("grid");
    document.getElementById("attend").disabled = !grid.querySelectorAll("input[type=checkbox]:checked").length;
    if(document.getElementById("attend").disabled) {
        document.getElementById("attend").classList.remove("green-btn");
        document.getElementById("attend").classList.add("grey-btn");
        document.getElementById("action").classList.remove("green-btn");
        document.getElementById("action").classList.add("grey-btn");
        document.getElementById("random").classList.add("green-btn");
        document.getElementById("random").classList.remove("grey-btn");
    } 
    else {
        document.getElementById("attend").classList.add("green-btn");
        document.getElementById("attend").classList.remove("grey-btn");
        document.getElementById("action").classList.add("green-btn");
        document.getElementById("action").classList.remove("grey-btn");
        document.getElementById("random").classList.remove("green-btn");
        document.getElementById("random").classList.add("grey-btn");
    }
    const areAllSelected = grid.querySelectorAll("input[type=checkbox]:checked").length === grid.querySelectorAll("input[type=checkbox]").length;
    document.getElementsByClassName("selectall")[0].style.display = areAllSelected ? "none" : "block";
    document.getElementsByClassName("hideall")[0].style.display = areAllSelected ? "block" : "none";      
}

// Below this line is not verified to work yet //

function selectAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = true;
    }
    document.getElementsByClassName("selectall")[0].style.display = "none";
    document.getElementsByClassName("hideall")[0].style.display = "block";
}

function hideAll() {
    var items = document.getElementsByTagName('input');
    for (var i = 0; i < items.length; i++) {
        if (items[i].type == 'checkbox')
            items[i].checked = false;
    }
    document.getElementsByClassName("selectall")[0].style.display = "block";
    document.getElementsByClassName("hideall")[0].style.display = "none";
}
#grid {
  margin: 20px;
  display: grid;
  grid-gap: 20px;}

.tile {
  width: 125px; height: 165px;
  font-size: 0.9rem;
  background-color: white;
  border-radius: 4%;
  overflow: hidden;
  text-align: center;
  box-shadow: 3px 4px #CECECE}
  .tile img{max-width: 100%; max-height: 100%; display: block;}
  .tile:hover {background-color: #C2CBB9; box-shadow: 3px 4px #9E999E; cursor: grab; transform: scale(1.05);}

.absent {filter: grayscale(100%); color: gray;}

.tile_pic{
  width: 125px;
  height: 125px;
  object-fit: cover;}

.tile_title {
  margin-top: 10px;
  font-family: 'Rubik', sans-serif;}

#grid input[type=checkbox] {display: none;}
#grid input:checked + label .tile{background-color: #A3B195; box-shadow: 3px 4px #9E999E}

@media (min-width: 430px) {#grid { grid-template-columns: repeat(5, 1fr); }}
@media (min-width: 660px) {#grid { grid-template-columns: repeat(6, 1fr); }}
@media (min-width: 890px) {#grid { grid-template-columns: repeat(7, 1fr); }}
@media (min-width: 1120px) {#grid { grid-template-columns: repeat(8, 1fr); }}
@media (min-width: 1350px) {#grid { grid-template-columns: repeat(9, 1fr); }}
@media (min-width: 1580px) {#grid { grid-template-columns: repeat(10, 1fr); }}




/* Begin editing below here */
body {background-color: #F2F2F2;}

#content {
  position: absolute;
  width: 100vw; height: calc(100vh - 120px);
  top: 60px; left: 0;
  padding-top: 30px}

#bottombar {
  position: fixed;
  width: 100vw; height: 60px;
  bottom: 0; left: 0;
  padding: 4px;
  box-sizing: border-box;
  border-top: 2px solid darkgray;
  background-color: white;}

.right{float: right;}
.left{float: left;}

#bottombar ul{
  margin: 0;
  padding: 0;
  list-style-type: none}
  #bottombar li{float: left}

.selectall, .hideall {font-size: 20px; padding: 11px}

/* Customizes the global button design */
#bottombar .button {
  padding: 8px 24px;
  margin-right: 8px;
  font-size: 18px;
  border-radius: 26px}
<link rel="stylesheet" href="https://classcolonies.com/resources/style.css">

<div id='content'>
  <form id='grid'>
    <input type='checkbox' name='upid[]' id='292' value='292' onclick='chk(this);'>
    <label for='292'>
      <div class='tile absent'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/default.png'>
        <div class='tile_title'><b>Charlie</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='306' value='306' onclick='chk(this);'>
    <label for='306'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/68.jpg'>
        <div class='tile_title'><b>Marshall</b></div>
      </div>
    </label>
    <input type='checkbox' name='upid[]' id='107' value='107' onclick='chk(this);'>
    <label for='107'>
      <div class='tile'>
        <img class='tile_pic' src='https://classcolonies.com/resources/pics/students/59.jpg'>
        <div class='tile_title'><b>Addix</b></div>
      </div>
    </label>
  </form>
</div>


<div id='bottombar'>
  
  <ul class="left">
    <li><a class="selectall" onclick='selectAll(); chk(this);'>Select All</a></li>
    <li><a class="hideall" style='display:none' onclick='hideAll(); chk(this);'>Select None</a></li>
  </ul>
  
  <ul class="right">
    <li><button id='attend' class="button grey-btn" disabled>Attendance</button></li>
    <li><button id='action' class="button grey-btn" disabled>Action</button></li>
    <li><button id='random' class="button green-btn">Random</button></li>
  </ul>

</div>
let condition = document.getElementById("attend").disabled;
document.getElementById("attend").classList.toogle("green-btn", !condition); // remove when condition is true, add when condition is false
document.getElementById("attend").classList.toogle("grey-btn", condition); // remove when condition is false, add when condition is true

Jetpack Compose: Textfield and FAB not using full width

copy iconCopydownload iconDownload
   HorizontalCenteredRow(
          modifier = Modifier.fillMaxWidth()
        HorizontalCenteredRow(modifier = Modifier
            .fillMaxWidth()) {
            val textState = remember { mutableStateOf(TextFieldValue()) }
            TextField(
                value = textState.value,
                onValueChange = { textState.value = it },
                modifier = Modifier.weight(1f)
            )
-----------------------
   HorizontalCenteredRow(
          modifier = Modifier.fillMaxWidth()
        HorizontalCenteredRow(modifier = Modifier
            .fillMaxWidth()) {
            val textState = remember { mutableStateOf(TextFieldValue()) }
            TextField(
                value = textState.value,
                onValueChange = { textState.value = it },
                modifier = Modifier.weight(1f)
            )

React - Adding new parameters to useState inside of useEffect is delayed

copy iconCopydownload iconDownload
    if (facetKey) {
      console.log(`${facetKey}: ${facetValue}`);
      setParams({
        [facetKey]: facetValue,  // updating params here
        ...params,
      });
    }
    console.log(params);

    const options = {
      method: "GET",
      url: "https://asos2.p.rapidapi.com/products/v2/list",
      params: params,  // using it here so this will always return previous value
      headers: {
        "x-rapidapi-key": "",
        "x-rapidapi-host": "",
      },
    };
    let requestParam = {};
    if (facetKey) {
      requestParam = {[facetKey]: facetValue, ...params}   // create const with expected value
      setParams({...requestParam});
    }

    const options = {
      method: "GET",
      url: "https://asos2.p.rapidapi.com/products/v2/list",
      params: requestParam,   // pass new const here in options
      headers: {
        "x-rapidapi-key": "",
        "x-rapidapi-host": "",
      },
    };
-----------------------
    if (facetKey) {
      console.log(`${facetKey}: ${facetValue}`);
      setParams({
        [facetKey]: facetValue,  // updating params here
        ...params,
      });
    }
    console.log(params);

    const options = {
      method: "GET",
      url: "https://asos2.p.rapidapi.com/products/v2/list",
      params: params,  // using it here so this will always return previous value
      headers: {
        "x-rapidapi-key": "",
        "x-rapidapi-host": "",
      },
    };
    let requestParam = {};
    if (facetKey) {
      requestParam = {[facetKey]: facetValue, ...params}   // create const with expected value
      setParams({...requestParam});
    }

    const options = {
      method: "GET",
      url: "https://asos2.p.rapidapi.com/products/v2/list",
      params: requestParam,   // pass new const here in options
      headers: {
        "x-rapidapi-key": "",
        "x-rapidapi-host": "",
      },
    };
-----------------------

// Receiving the Key and Value when a user interacts with the "sorting" dropdowns.
const facetValue = props.facetValue;
const facetKey = props.facetKey;

// Setting initial parameters
const [params, setParams] = useState({
  store: "US",
  offset: props.offset,
  categoryId: props.categoryId,
  limit: props.limit,
  country: "US",
  sort: "freshness",
  currency: "USD",
  sizeSchema: "US",
  lang: "en-US",
});

useEffect(() => {
  // if FacetKey is not undefined.
  if (facetKey) {
    console.log(`${facetKey}: ${facetValue}`);
    setParams((currParams) => { ...currParams, [facetKey]: facetValue });
  }

  // Is it my dependencies that are incorrect?
}, [props.limit, facetKey]);



useEffect(() => {
  // you can move your api call to a function itself which takes params
  const options = {
    method: "GET",
    url: "https://asos2.p.rapidapi.com/products/v2/list",
    params: params,
    headers: {
      "x-rapidapi-key": "",
      "x-rapidapi-host": "",
    },
  };
  axios
    .request(options)
    .then(function (response) {
      setProducts(response.data.products);
      // assuming here that props.items is more like props.setItems as you are setting it's value
      props.items(response.data.itemCount);
      // assuming here that props.facets is more like props.setFacets as you are setting it's value
      props.facets(response.data.facets);
    })
    .catch(function (error) {
      console.error(error);
    });
}, [params]);

How can we hide BottomAppBar (with navigation include) when navigate to composable?

copy iconCopydownload iconDownload
Scaffold(
    bottomBar = {
        if (currentRoute != "xxxx") {
            BottomAppBar() {
               //....
            }
        }
    },
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentRoute = navBackStackEntry.destination.route
-----------------------
Scaffold(
    bottomBar = {
        if (currentRoute != "xxxx") {
            BottomAppBar() {
               //....
            }
        }
    },
val navBackStackEntry by navController.currentBackStackEntryAsState()
val currentRoute = navBackStackEntry.destination.route

How to combine FAB with BottomAppBar without overlapping nav items?

copy iconCopydownload iconDownload
bottomBar = {
            BottomAppBar(cutoutShape = fabShape) {
                BottomNavigation {
                    items.forEachIndexed { index, item ->
                        if (index != 2){ // 
                        BottomNavigationItem(
                            // your implementation
                        )} else {
                            //Empty BottomNavigationItem
                            BottomNavigationItem(
                                icon = {},
                                label = {  },
                                selected = false,
                                onClick = {  },
                                enabled = false
                            )
                        }
                    }
                }

            }
        },

How to change the color of the BottomNavigationView Icons when I navigate to a Fragment that isn't in that menu

copy iconCopydownload iconDownload
findViewById<BottomNavigationView>(R.id. bottomNavigationView).getMenu().setGroupCheckable(0, false, true);
override fun onMenuItemClick(item: MenuItem?): Boolean {
        when(item?.itemId) {
            R.id.app_bar_notification -> {
                changeFragment(NotificationsFragment(), getString(R.string.tag_notifications))
            }
        }
        return true
    }
override fun onMenuItemClick(item: MenuItem?): Boolean {
        when(item?.itemId) {
            R.id.app_bar_notification -> {
                changeFragment(NotificationsFragment(), getString(R.string.tag_notifications))
                findViewById<BottomNavigationView>(R.id. bottomNavigationView).getMenu().setGroupCheckable(0, false, true);
            }
        }
        return true
    }
-----------------------
findViewById<BottomNavigationView>(R.id. bottomNavigationView).getMenu().setGroupCheckable(0, false, true);
override fun onMenuItemClick(item: MenuItem?): Boolean {
        when(item?.itemId) {
            R.id.app_bar_notification -> {
                changeFragment(NotificationsFragment(), getString(R.string.tag_notifications))
            }
        }
        return true
    }
override fun onMenuItemClick(item: MenuItem?): Boolean {
        when(item?.itemId) {
            R.id.app_bar_notification -> {
                changeFragment(NotificationsFragment(), getString(R.string.tag_notifications))
                findViewById<BottomNavigationView>(R.id. bottomNavigationView).getMenu().setGroupCheckable(0, false, true);
            }
        }
        return true
    }
-----------------------
findViewById<BottomNavigationView>(R.id. bottomNavigationView).getMenu().setGroupCheckable(0, false, true);
override fun onMenuItemClick(item: MenuItem?): Boolean {
        when(item?.itemId) {
            R.id.app_bar_notification -> {
                changeFragment(NotificationsFragment(), getString(R.string.tag_notifications))
            }
        }
        return true
    }
override fun onMenuItemClick(item: MenuItem?): Boolean {
        when(item?.itemId) {
            R.id.app_bar_notification -> {
                changeFragment(NotificationsFragment(), getString(R.string.tag_notifications))
                findViewById<BottomNavigationView>(R.id. bottomNavigationView).getMenu().setGroupCheckable(0, false, true);
            }
        }
        return true
    }

I have a FAB anchored to a bottom bar that have a bugged behavior

copy iconCopydownload iconDownload
<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:id="@+id/bottomBarContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom">

    <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/fabNewIssue"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/strong_blue"
            android:contentDescription="Add Issue"
            app:srcCompat="@drawable/ic_outline_add_24"
            app:tint="@color/white"
            app:fabCustomSize="60dp"
            app:layout_anchor="@+id/bottomBar"
            app:layout_anchorGravity="top|center"/>

        <com.google.android.material.bottomappbar.BottomAppBar
            android:id="@+id/bottomBar"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            app:fabAlignmentMode="center"
            app:fabCradleMargin="10dp"
            app:fabCradleRoundedCornerRadius="10dp">

            <com.google.android.material.bottomnavigation.BottomNavigationView
                android:id="@+id/bottomNavigationView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginEnd="16dp"
                android:background="@android:color/transparent"
                app:menu="@menu/bottom_nav_menu"/>

    </com.google.android.material.bottomappbar.BottomAppBar>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    (activity as MainActivity).let {
        it.toolbarText = "Olá " + it.user?.name
        it.appbar.setExpanded(true)
        it.binding.bottomBarContainer.visibility = View.GONE
        it.binding.mainFragmentContainer.setPadding(0,0,0, 
                  Utils().convertDpToPixel(60f,requireContext()).toInt())
    }
}
-----------------------
<androidx.coordinatorlayout.widget.CoordinatorLayout
    android:id="@+id/bottomBarContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="bottom">

    <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/fabNewIssue"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:backgroundTint="@color/strong_blue"
            android:contentDescription="Add Issue"
            app:srcCompat="@drawable/ic_outline_add_24"
            app:tint="@color/white"
            app:fabCustomSize="60dp"
            app:layout_anchor="@+id/bottomBar"
            app:layout_anchorGravity="top|center"/>

        <com.google.android.material.bottomappbar.BottomAppBar
            android:id="@+id/bottomBar"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            app:fabAlignmentMode="center"
            app:fabCradleMargin="10dp"
            app:fabCradleRoundedCornerRadius="10dp">

            <com.google.android.material.bottomnavigation.BottomNavigationView
                android:id="@+id/bottomNavigationView"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginEnd="16dp"
                android:background="@android:color/transparent"
                app:menu="@menu/bottom_nav_menu"/>

    </com.google.android.material.bottomappbar.BottomAppBar>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    (activity as MainActivity).let {
        it.toolbarText = "Olá " + it.user?.name
        it.appbar.setExpanded(true)
        it.binding.bottomBarContainer.visibility = View.GONE
        it.binding.mainFragmentContainer.setPadding(0,0,0, 
                  Utils().convertDpToPixel(60f,requireContext()).toInt())
    }
}

The idea is make click on &lt;a&gt; tag to display dropdown menu items

copy iconCopydownload iconDownload
$(document).ready(function(){   
    if ($(window).width() < 980) {
      // mobile menu
      $('.hamburger').click(function (event) {
        $(this).toggleClass('h-active');
        $('.main-nav').toggleClass('slidenav');
      });

      $('.header-home .main-nav ul li  a').click(function (event) {
        $('.hamburger').removeClass('h-active');
        $('.main-nav').removeClass('slidenav');
      });
    }


    $(".main-nav .fl").on('click', function(event) {
      event.preventDefault();
      var $fl = $(this);
      $(this).parent().siblings().find('.submenu').slideUp();
/* begin change */
      $(this).parent().siblings().find('.fl').removeClass('open');       
      if($fl.hasClass('open')){
        $fl.removeClass('open');
      }else{
        $fl.addClass('open');
      }
/* end change */
      $fl.next(".submenu").slideToggle();
    });

});
.hamburger {
    position: relative;
    width: 40px;
    height: 30px;
    cursor: pointer;
    border: 5px solid transparent;
    float: right;
    margin-top: 35px
}
.hamburger span {
    width: 100%;
    height: 2px;
    background: #08509e;
    display: block;
    position: absolute;
    right: 0;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.hamburger span.h-top {
    top: 0
}
.hamburger span.h-bottom {
    bottom: 0;
    width: 27px
}
.hamburger span.h-middle {
    top: 50%;
    margin-top: -1px;
    width: 25px
}
.hamburger.h-active span {
    width: 100%
}
.hamburger.h-active span.h-top {
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
    top: 50%;
    margin-top: -1px
}
.hamburger.h-active span.h-middle {
    -webkit-transform: translateX(-30px);
    -moz-transform: translateX(-30px);
    -ms-transform: translateX(-30px);
    -o-transform: translateX(-30px);
    transform: translateX(-30px);
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
    opacity: 0
}
.hamburger.h-active span.h-bottom {
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
    bottom: 50%;
    margin-bottom: -1px
}

.bottombar {
    background-color: #08509e
}
.main-nav>ul {
    padding: 0;
    margin: 0;
    list-style: none
}
.main-nav>ul>li {
    display: inline-block;
    position: relative;
    margin-left: -4px;
    padding-right: 15px
}
.main-nav>ul>li+li {
    padding: 0 15px
}
.main-nav>ul>li>a {
    text-transform: uppercase;
    display: block;
    text-decoration: none;
    color: #000;
    line-height: 45px;
    font-size: 16px;
    position: relative;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.main-nav>ul>li:hover>a {
    color: #00b7d7
}
.submenu {
    position: absolute;
    left: 0;
    top: auto;
    right: 0;
    min-width: 200px;
    list-style: none;
    margin: 0;
    padding: 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #f7f7f7;
    -webkit-border-radius: 0 0 3px 3px;
    -moz-border-radius: 0 0 3px 3px;
    -ms-border-radius: 0 0 3px 3px;
    -o-border-radius: 0 0 3px 3px;
    border-radius: 0 0 3px 3px;
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
    opacity: 0;
    visibility: hidden;
    z-index: 9999;
    -webkit-box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.3);
    -moz-box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.3);
    box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.3);
    -webkit-transform: translateY(20px);
    -moz-transform: translateY(20px);
    -ms-transform: translateY(20px);
    -o-transform: translateY(20px);
    transform: translateY(20px);
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.submenu>li {
    display: block;
    margin: 0 -15px
}
.submenu>li a {
    display: block;
    padding: 10px 15px;
    color: #666;
    line-height: 1;
    font-size: 14px;
    text-decoration: none;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.submenu>li a:hover {
    background: #f7f7f7;
    color: #08509e
}
/* begin change */
.main-nav .fl:after {
    content: "+"; 
    width: 30px;
    font-size: 20px;
    line-height: 35px;
    text-align: center;
    color: #fff;
    font-style: normal;
    position: absolute;
    right: 5px;
    top: 0;
    z-index: 999;
    display: none
}
.main-nav .fl.open:after {
  content: "-";
}
/* end change */
.main-nav .fl:before {
    font-size: 14px;
    text-align: center;
    line-height: 35px
}
.main-nav>ul>li+li .submenu {
    left: 25px
}
.main-nav>ul>li:hover .submenu {
    -webkit-transform: translateY(0);
    -moz-transform: translateY(0);
    -ms-transform: translateY(0);
    -o-transform: translateY(0);
    transform: translateY(0);
    visibility: visible;
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
    opacity: 1
}
.content-block {
    padding: 70px 0;
    position: relative
}
.slideInUp {
    visibility: hidden;
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
    opacity: 0;
    -webkit-transform: translate3d(0, 30px, 0);
    -moz-transform: translate3d(0, 30px, 0);
    -ms-transform: translate3d(0, 30px, 0);
    -o-transform: translate3d(0, 30px, 0);
    transform: translate3d(0, 30px, 0);
    -webkit-transition: all 1s ease-out;
    -moz-transition: all 1s ease-out;
    -o-transition: all 1s ease-out;
    transition: all 1s ease-out
}
.is-active .slideInUp {
    visibility: visible;
    opacity: 1;
    -webkit-transform: translate3d(0, 0, 0);
    -moz-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    -o-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0)
}
.slideInUp2 {
    -webkit-transition-delay: .3s;
    -moz-transition-delay: .3s;
    -o-transition-delay: .3s;
    transition-delay: .3s
}

@media (min-width:980px) {
    .hamburger {
        display:none;
    }
}
@media (max-width: 980px) {
    .main-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 250px;
        padding: 20px;
        z-index: 99999;
        height: 100%;
        overflow: auto;
        background: #000;
        -webkit-overflow-scrolling: touch;
        -webkit-transform: translateX(-250px);
        -moz-transform: translateX(-250px);
        -ms-transform: translateX(-250px);
        -o-transform: translateX(-250px);
        transform: translateX(-250px);
        -webkit-transition: -webkit-transform .3s ease-in;
        -moz-transition: -moz-transform .3s ease-in;
        -o-transition: -o-transform .3s ease-in;
        transition: transform 0.3s ease-in
    }
    .main-nav.slidenav {
        -webkit-transform: translateX(0);
        -moz-transform: translateX(0);
        -ms-transform: translateX(0);
        -o-transform: translateX(0);
        transform: translateX(0)
    }
    .main-nav>ul {
        float: none
    }
    .main-nav>ul>li {
        display: block;
        padding: 0 !important;
        margin-left: 0
    }
    .main-nav>ul>li>a {
        font-size: 14px;
        color: #fff;
        line-height: 35px
    }
    .main-nav .fl:after {
        display: block;
        line-height: 35px
    }
    .submenu {
        position: static;
        min-width: 200px;
        background: transparent;
        border: none;
        padding: 5px 15px 5px 25px;
        filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
        opacity: 1;
        visibility: visible;
        -webkit-box-shadow: none;
        -moz-box-shadow: none;
        box-shadow: none;
        -webkit-transform: none;
        -moz-transform: none;
        -ms-transform: none;
        -o-transform: none;
        transform: none;
        -webkit-transition: none;
        -moz-transition: none;
        -o-transition: none;
        transition: none;
        display: none
    }
    .submenu>li a {
        display: block;
        padding: 10px 0;
        color: #666;
        line-height: 0.8;
        font-size: 14px;
        color: #ccc;
        text-decoration: none;
        -webkit-transition: all .3s;
        -moz-transition: all .3s;
        -o-transition: all .3s;
        transition: all 0.3s
    }
    .submenu>li a:hover {
        background: transparent;
        color: #08509e
    }
    .slideInUp {
        visibility: visible;
        filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
        opacity: 1;
        -webkit-transform: translate3d(0, 0, 0);
        -moz-transform: translate3d(0, 0, 0);
        -ms-transform: translate3d(0, 0, 0);
        -o-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
        -webkit-transition: none;
        -moz-transition: none;
        -o-transition: none;
        transition: none
    }
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<a href="javascript:void(0)" class="hidden-lg hamburger">
  <span class="h-top"></span>
  <span class="h-middle"></span>
  <span class="h-bottom"></span>
</a>
    
<nav class="main-nav">
  <ul>
    <li>
      <a href="#" class="fl">ABOUT US</a>
      <ul class="submenu">
        <li><a href="mission-statement.php">Mission Statement</a></li>
        <li><a href="participating-dentists.php">Participating Dentists</a></li>
        <li><a href="services.php">Services</a></li>
      </ul>          
    </li>
    <li>
      <a href="#" class="fl">PATIENT</a> 
      <ul class="submenu">
        <li><a href="medical-history-forms.php">Medical History Forms</a></li>
        <li><a href="before-surgery.php">Before Surgery</a></li>
        <li><a href="after-surgery.php">After Surgery</a></li>
        <li><a href="children-and-special-needs-adults.php">Children and Special Needs Adults</a></li>
        <li><a href="privacy.php">Privacy</a></li>
        <li><a href="rights-and-responsibilities.php">Rights and Responsibilities</a></li>
        <li><a href="financial-information.php">Financial Information</a></li>
      </ul>             
    </li>
    <li>
      <a href="javascript:void(0)" class="fl">INFORMATION</a>
      <ul class="submenu">
        <li><a href="privileging-criteria.php">Privileging Criteria</a></li>
        <li><a href="privileging-board-members.php">Privileging Board Members</a></li>
        <li><a href="privileging-criteria.php#reqInfo">Request for Information</a></li>              
      </ul> 
    </li>
    <li><a href="map-and-directions.php">MAP &amp; DIRECTIONS</a></li>
    <li><a href="news.php">NEWS</a></li>
    <li><a href="employment.php">EMPLOYMENT</a></li>                  
    <li><a href="#">CONTACT US</a></li>
  </ul>
  <div class="mob-login hidden-lg">
    <a href="#" class="btn btn-outline">LOGIN</a>
  </div>
</nav>
-----------------------
$(document).ready(function(){   
    if ($(window).width() < 980) {
      // mobile menu
      $('.hamburger').click(function (event) {
        $(this).toggleClass('h-active');
        $('.main-nav').toggleClass('slidenav');
      });

      $('.header-home .main-nav ul li  a').click(function (event) {
        $('.hamburger').removeClass('h-active');
        $('.main-nav').removeClass('slidenav');
      });
    }


    $(".main-nav .fl").on('click', function(event) {
      event.preventDefault();
      var $fl = $(this);
      $(this).parent().siblings().find('.submenu').slideUp();
/* begin change */
      $(this).parent().siblings().find('.fl').removeClass('open');       
      if($fl.hasClass('open')){
        $fl.removeClass('open');
      }else{
        $fl.addClass('open');
      }
/* end change */
      $fl.next(".submenu").slideToggle();
    });

});
.hamburger {
    position: relative;
    width: 40px;
    height: 30px;
    cursor: pointer;
    border: 5px solid transparent;
    float: right;
    margin-top: 35px
}
.hamburger span {
    width: 100%;
    height: 2px;
    background: #08509e;
    display: block;
    position: absolute;
    right: 0;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.hamburger span.h-top {
    top: 0
}
.hamburger span.h-bottom {
    bottom: 0;
    width: 27px
}
.hamburger span.h-middle {
    top: 50%;
    margin-top: -1px;
    width: 25px
}
.hamburger.h-active span {
    width: 100%
}
.hamburger.h-active span.h-top {
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
    top: 50%;
    margin-top: -1px
}
.hamburger.h-active span.h-middle {
    -webkit-transform: translateX(-30px);
    -moz-transform: translateX(-30px);
    -ms-transform: translateX(-30px);
    -o-transform: translateX(-30px);
    transform: translateX(-30px);
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
    opacity: 0
}
.hamburger.h-active span.h-bottom {
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
    bottom: 50%;
    margin-bottom: -1px
}

.bottombar {
    background-color: #08509e
}
.main-nav>ul {
    padding: 0;
    margin: 0;
    list-style: none
}
.main-nav>ul>li {
    display: inline-block;
    position: relative;
    margin-left: -4px;
    padding-right: 15px
}
.main-nav>ul>li+li {
    padding: 0 15px
}
.main-nav>ul>li>a {
    text-transform: uppercase;
    display: block;
    text-decoration: none;
    color: #000;
    line-height: 45px;
    font-size: 16px;
    position: relative;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.main-nav>ul>li:hover>a {
    color: #00b7d7
}
.submenu {
    position: absolute;
    left: 0;
    top: auto;
    right: 0;
    min-width: 200px;
    list-style: none;
    margin: 0;
    padding: 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #f7f7f7;
    -webkit-border-radius: 0 0 3px 3px;
    -moz-border-radius: 0 0 3px 3px;
    -ms-border-radius: 0 0 3px 3px;
    -o-border-radius: 0 0 3px 3px;
    border-radius: 0 0 3px 3px;
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
    opacity: 0;
    visibility: hidden;
    z-index: 9999;
    -webkit-box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.3);
    -moz-box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.3);
    box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.3);
    -webkit-transform: translateY(20px);
    -moz-transform: translateY(20px);
    -ms-transform: translateY(20px);
    -o-transform: translateY(20px);
    transform: translateY(20px);
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.submenu>li {
    display: block;
    margin: 0 -15px
}
.submenu>li a {
    display: block;
    padding: 10px 15px;
    color: #666;
    line-height: 1;
    font-size: 14px;
    text-decoration: none;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.submenu>li a:hover {
    background: #f7f7f7;
    color: #08509e
}
/* begin change */
.main-nav .fl:after {
    content: "+"; 
    width: 30px;
    font-size: 20px;
    line-height: 35px;
    text-align: center;
    color: #fff;
    font-style: normal;
    position: absolute;
    right: 5px;
    top: 0;
    z-index: 999;
    display: none
}
.main-nav .fl.open:after {
  content: "-";
}
/* end change */
.main-nav .fl:before {
    font-size: 14px;
    text-align: center;
    line-height: 35px
}
.main-nav>ul>li+li .submenu {
    left: 25px
}
.main-nav>ul>li:hover .submenu {
    -webkit-transform: translateY(0);
    -moz-transform: translateY(0);
    -ms-transform: translateY(0);
    -o-transform: translateY(0);
    transform: translateY(0);
    visibility: visible;
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
    opacity: 1
}
.content-block {
    padding: 70px 0;
    position: relative
}
.slideInUp {
    visibility: hidden;
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
    opacity: 0;
    -webkit-transform: translate3d(0, 30px, 0);
    -moz-transform: translate3d(0, 30px, 0);
    -ms-transform: translate3d(0, 30px, 0);
    -o-transform: translate3d(0, 30px, 0);
    transform: translate3d(0, 30px, 0);
    -webkit-transition: all 1s ease-out;
    -moz-transition: all 1s ease-out;
    -o-transition: all 1s ease-out;
    transition: all 1s ease-out
}
.is-active .slideInUp {
    visibility: visible;
    opacity: 1;
    -webkit-transform: translate3d(0, 0, 0);
    -moz-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    -o-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0)
}
.slideInUp2 {
    -webkit-transition-delay: .3s;
    -moz-transition-delay: .3s;
    -o-transition-delay: .3s;
    transition-delay: .3s
}

@media (min-width:980px) {
    .hamburger {
        display:none;
    }
}
@media (max-width: 980px) {
    .main-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 250px;
        padding: 20px;
        z-index: 99999;
        height: 100%;
        overflow: auto;
        background: #000;
        -webkit-overflow-scrolling: touch;
        -webkit-transform: translateX(-250px);
        -moz-transform: translateX(-250px);
        -ms-transform: translateX(-250px);
        -o-transform: translateX(-250px);
        transform: translateX(-250px);
        -webkit-transition: -webkit-transform .3s ease-in;
        -moz-transition: -moz-transform .3s ease-in;
        -o-transition: -o-transform .3s ease-in;
        transition: transform 0.3s ease-in
    }
    .main-nav.slidenav {
        -webkit-transform: translateX(0);
        -moz-transform: translateX(0);
        -ms-transform: translateX(0);
        -o-transform: translateX(0);
        transform: translateX(0)
    }
    .main-nav>ul {
        float: none
    }
    .main-nav>ul>li {
        display: block;
        padding: 0 !important;
        margin-left: 0
    }
    .main-nav>ul>li>a {
        font-size: 14px;
        color: #fff;
        line-height: 35px
    }
    .main-nav .fl:after {
        display: block;
        line-height: 35px
    }
    .submenu {
        position: static;
        min-width: 200px;
        background: transparent;
        border: none;
        padding: 5px 15px 5px 25px;
        filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
        opacity: 1;
        visibility: visible;
        -webkit-box-shadow: none;
        -moz-box-shadow: none;
        box-shadow: none;
        -webkit-transform: none;
        -moz-transform: none;
        -ms-transform: none;
        -o-transform: none;
        transform: none;
        -webkit-transition: none;
        -moz-transition: none;
        -o-transition: none;
        transition: none;
        display: none
    }
    .submenu>li a {
        display: block;
        padding: 10px 0;
        color: #666;
        line-height: 0.8;
        font-size: 14px;
        color: #ccc;
        text-decoration: none;
        -webkit-transition: all .3s;
        -moz-transition: all .3s;
        -o-transition: all .3s;
        transition: all 0.3s
    }
    .submenu>li a:hover {
        background: transparent;
        color: #08509e
    }
    .slideInUp {
        visibility: visible;
        filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
        opacity: 1;
        -webkit-transform: translate3d(0, 0, 0);
        -moz-transform: translate3d(0, 0, 0);
        -ms-transform: translate3d(0, 0, 0);
        -o-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
        -webkit-transition: none;
        -moz-transition: none;
        -o-transition: none;
        transition: none
    }
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<a href="javascript:void(0)" class="hidden-lg hamburger">
  <span class="h-top"></span>
  <span class="h-middle"></span>
  <span class="h-bottom"></span>
</a>
    
<nav class="main-nav">
  <ul>
    <li>
      <a href="#" class="fl">ABOUT US</a>
      <ul class="submenu">
        <li><a href="mission-statement.php">Mission Statement</a></li>
        <li><a href="participating-dentists.php">Participating Dentists</a></li>
        <li><a href="services.php">Services</a></li>
      </ul>          
    </li>
    <li>
      <a href="#" class="fl">PATIENT</a> 
      <ul class="submenu">
        <li><a href="medical-history-forms.php">Medical History Forms</a></li>
        <li><a href="before-surgery.php">Before Surgery</a></li>
        <li><a href="after-surgery.php">After Surgery</a></li>
        <li><a href="children-and-special-needs-adults.php">Children and Special Needs Adults</a></li>
        <li><a href="privacy.php">Privacy</a></li>
        <li><a href="rights-and-responsibilities.php">Rights and Responsibilities</a></li>
        <li><a href="financial-information.php">Financial Information</a></li>
      </ul>             
    </li>
    <li>
      <a href="javascript:void(0)" class="fl">INFORMATION</a>
      <ul class="submenu">
        <li><a href="privileging-criteria.php">Privileging Criteria</a></li>
        <li><a href="privileging-board-members.php">Privileging Board Members</a></li>
        <li><a href="privileging-criteria.php#reqInfo">Request for Information</a></li>              
      </ul> 
    </li>
    <li><a href="map-and-directions.php">MAP &amp; DIRECTIONS</a></li>
    <li><a href="news.php">NEWS</a></li>
    <li><a href="employment.php">EMPLOYMENT</a></li>                  
    <li><a href="#">CONTACT US</a></li>
  </ul>
  <div class="mob-login hidden-lg">
    <a href="#" class="btn btn-outline">LOGIN</a>
  </div>
</nav>
-----------------------
$(document).ready(function(){   
    if ($(window).width() < 980) {
      // mobile menu
      $('.hamburger').click(function (event) {
        $(this).toggleClass('h-active');
        $('.main-nav').toggleClass('slidenav');
      });

      $('.header-home .main-nav ul li  a').click(function (event) {
        $('.hamburger').removeClass('h-active');
        $('.main-nav').removeClass('slidenav');
      });
    }


    $(".main-nav .fl").on('click', function(event) {
      event.preventDefault();
      var $fl = $(this);
      $(this).parent().siblings().find('.submenu').slideUp();
/* begin change */
      $(this).parent().siblings().find('.fl').removeClass('open');       
      if($fl.hasClass('open')){
        $fl.removeClass('open');
      }else{
        $fl.addClass('open');
      }
/* end change */
      $fl.next(".submenu").slideToggle();
    });

});
.hamburger {
    position: relative;
    width: 40px;
    height: 30px;
    cursor: pointer;
    border: 5px solid transparent;
    float: right;
    margin-top: 35px
}
.hamburger span {
    width: 100%;
    height: 2px;
    background: #08509e;
    display: block;
    position: absolute;
    right: 0;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.hamburger span.h-top {
    top: 0
}
.hamburger span.h-bottom {
    bottom: 0;
    width: 27px
}
.hamburger span.h-middle {
    top: 50%;
    margin-top: -1px;
    width: 25px
}
.hamburger.h-active span {
    width: 100%
}
.hamburger.h-active span.h-top {
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -ms-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
    top: 50%;
    margin-top: -1px
}
.hamburger.h-active span.h-middle {
    -webkit-transform: translateX(-30px);
    -moz-transform: translateX(-30px);
    -ms-transform: translateX(-30px);
    -o-transform: translateX(-30px);
    transform: translateX(-30px);
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
    opacity: 0
}
.hamburger.h-active span.h-bottom {
    -webkit-transform: rotate(-45deg);
    -moz-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    -o-transform: rotate(-45deg);
    transform: rotate(-45deg);
    bottom: 50%;
    margin-bottom: -1px
}

.bottombar {
    background-color: #08509e
}
.main-nav>ul {
    padding: 0;
    margin: 0;
    list-style: none
}
.main-nav>ul>li {
    display: inline-block;
    position: relative;
    margin-left: -4px;
    padding-right: 15px
}
.main-nav>ul>li+li {
    padding: 0 15px
}
.main-nav>ul>li>a {
    text-transform: uppercase;
    display: block;
    text-decoration: none;
    color: #000;
    line-height: 45px;
    font-size: 16px;
    position: relative;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.main-nav>ul>li:hover>a {
    color: #00b7d7
}
.submenu {
    position: absolute;
    left: 0;
    top: auto;
    right: 0;
    min-width: 200px;
    list-style: none;
    margin: 0;
    padding: 0;
    padding: 15px;
    background: #fff;
    border: 1px solid #f7f7f7;
    -webkit-border-radius: 0 0 3px 3px;
    -moz-border-radius: 0 0 3px 3px;
    -ms-border-radius: 0 0 3px 3px;
    -o-border-radius: 0 0 3px 3px;
    border-radius: 0 0 3px 3px;
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
    opacity: 0;
    visibility: hidden;
    z-index: 9999;
    -webkit-box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.3);
    -moz-box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.3);
    box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.3);
    -webkit-transform: translateY(20px);
    -moz-transform: translateY(20px);
    -ms-transform: translateY(20px);
    -o-transform: translateY(20px);
    transform: translateY(20px);
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.submenu>li {
    display: block;
    margin: 0 -15px
}
.submenu>li a {
    display: block;
    padding: 10px 15px;
    color: #666;
    line-height: 1;
    font-size: 14px;
    text-decoration: none;
    -webkit-transition: all .3s;
    -moz-transition: all .3s;
    -o-transition: all .3s;
    transition: all 0.3s
}
.submenu>li a:hover {
    background: #f7f7f7;
    color: #08509e
}
/* begin change */
.main-nav .fl:after {
    content: "+"; 
    width: 30px;
    font-size: 20px;
    line-height: 35px;
    text-align: center;
    color: #fff;
    font-style: normal;
    position: absolute;
    right: 5px;
    top: 0;
    z-index: 999;
    display: none
}
.main-nav .fl.open:after {
  content: "-";
}
/* end change */
.main-nav .fl:before {
    font-size: 14px;
    text-align: center;
    line-height: 35px
}
.main-nav>ul>li+li .submenu {
    left: 25px
}
.main-nav>ul>li:hover .submenu {
    -webkit-transform: translateY(0);
    -moz-transform: translateY(0);
    -ms-transform: translateY(0);
    -o-transform: translateY(0);
    transform: translateY(0);
    visibility: visible;
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
    opacity: 1
}
.content-block {
    padding: 70px 0;
    position: relative
}
.slideInUp {
    visibility: hidden;
    filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=0);
    opacity: 0;
    -webkit-transform: translate3d(0, 30px, 0);
    -moz-transform: translate3d(0, 30px, 0);
    -ms-transform: translate3d(0, 30px, 0);
    -o-transform: translate3d(0, 30px, 0);
    transform: translate3d(0, 30px, 0);
    -webkit-transition: all 1s ease-out;
    -moz-transition: all 1s ease-out;
    -o-transition: all 1s ease-out;
    transition: all 1s ease-out
}
.is-active .slideInUp {
    visibility: visible;
    opacity: 1;
    -webkit-transform: translate3d(0, 0, 0);
    -moz-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    -o-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0)
}
.slideInUp2 {
    -webkit-transition-delay: .3s;
    -moz-transition-delay: .3s;
    -o-transition-delay: .3s;
    transition-delay: .3s
}

@media (min-width:980px) {
    .hamburger {
        display:none;
    }
}
@media (max-width: 980px) {
    .main-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 250px;
        padding: 20px;
        z-index: 99999;
        height: 100%;
        overflow: auto;
        background: #000;
        -webkit-overflow-scrolling: touch;
        -webkit-transform: translateX(-250px);
        -moz-transform: translateX(-250px);
        -ms-transform: translateX(-250px);
        -o-transform: translateX(-250px);
        transform: translateX(-250px);
        -webkit-transition: -webkit-transform .3s ease-in;
        -moz-transition: -moz-transform .3s ease-in;
        -o-transition: -o-transform .3s ease-in;
        transition: transform 0.3s ease-in
    }
    .main-nav.slidenav {
        -webkit-transform: translateX(0);
        -moz-transform: translateX(0);
        -ms-transform: translateX(0);
        -o-transform: translateX(0);
        transform: translateX(0)
    }
    .main-nav>ul {
        float: none
    }
    .main-nav>ul>li {
        display: block;
        padding: 0 !important;
        margin-left: 0
    }
    .main-nav>ul>li>a {
        font-size: 14px;
        color: #fff;
        line-height: 35px
    }
    .main-nav .fl:after {
        display: block;
        line-height: 35px
    }
    .submenu {
        position: static;
        min-width: 200px;
        background: transparent;
        border: none;
        padding: 5px 15px 5px 25px;
        filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
        opacity: 1;
        visibility: visible;
        -webkit-box-shadow: none;
        -moz-box-shadow: none;
        box-shadow: none;
        -webkit-transform: none;
        -moz-transform: none;
        -ms-transform: none;
        -o-transform: none;
        transform: none;
        -webkit-transition: none;
        -moz-transition: none;
        -o-transition: none;
        transition: none;
        display: none
    }
    .submenu>li a {
        display: block;
        padding: 10px 0;
        color: #666;
        line-height: 0.8;
        font-size: 14px;
        color: #ccc;
        text-decoration: none;
        -webkit-transition: all .3s;
        -moz-transition: all .3s;
        -o-transition: all .3s;
        transition: all 0.3s
    }
    .submenu>li a:hover {
        background: transparent;
        color: #08509e
    }
    .slideInUp {
        visibility: visible;
        filter: progid: DXImageTransform.Microsoft.Alpha(Opacity=100);
        opacity: 1;
        -webkit-transform: translate3d(0, 0, 0);
        -moz-transform: translate3d(0, 0, 0);
        -ms-transform: translate3d(0, 0, 0);
        -o-transform: translate3d(0, 0, 0);
        transform: translate3d(0, 0, 0);
        -webkit-transition: none;
        -moz-transition: none;
        -o-transition: none;
        transition: none
    }
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<a href="javascript:void(0)" class="hidden-lg hamburger">
  <span class="h-top"></span>
  <span class="h-middle"></span>
  <span class="h-bottom"></span>
</a>
    
<nav class="main-nav">
  <ul>
    <li>
      <a href="#" class="fl">ABOUT US</a>
      <ul class="submenu">
        <li><a href="mission-statement.php">Mission Statement</a></li>
        <li><a href="participating-dentists.php">Participating Dentists</a></li>
        <li><a href="services.php">Services</a></li>
      </ul>          
    </li>
    <li>
      <a href="#" class="fl">PATIENT</a> 
      <ul class="submenu">
        <li><a href="medical-history-forms.php">Medical History Forms</a></li>
        <li><a href="before-surgery.php">Before Surgery</a></li>
        <li><a href="after-surgery.php">After Surgery</a></li>
        <li><a href="children-and-special-needs-adults.php">Children and Special Needs Adults</a></li>
        <li><a href="privacy.php">Privacy</a></li>
        <li><a href="rights-and-responsibilities.php">Rights and Responsibilities</a></li>
        <li><a href="financial-information.php">Financial Information</a></li>
      </ul>             
    </li>
    <li>
      <a href="javascript:void(0)" class="fl">INFORMATION</a>
      <ul class="submenu">
        <li><a href="privileging-criteria.php">Privileging Criteria</a></li>
        <li><a href="privileging-board-members.php">Privileging Board Members</a></li>
        <li><a href="privileging-criteria.php#reqInfo">Request for Information</a></li>              
      </ul> 
    </li>
    <li><a href="map-and-directions.php">MAP &amp; DIRECTIONS</a></li>
    <li><a href="news.php">NEWS</a></li>
    <li><a href="employment.php">EMPLOYMENT</a></li>                  
    <li><a href="#">CONTACT US</a></li>
  </ul>
  <div class="mob-login hidden-lg">
    <a href="#" class="btn btn-outline">LOGIN</a>
  </div>
</nav>

Community Discussions

Trending Discussions on BottomBar
  • Set after value for DIV dynamically
  • Create One Larger Item in Row/Column Jetpack Compose
  • Jetpack Compose TopBar and BottomBar Default Elevation content doesn't fill its container
  • how can I change the text color if it focused?
  • Javascript validate all checkboxes are selected
  • Jetpack Compose: Textfield and FAB not using full width
  • React - Adding new parameters to useState inside of useEffect is delayed
  • Bottom Navigation in Compose
  • How can we hide BottomAppBar (with navigation include) when navigate to composable?
  • How to combine FAB with BottomAppBar without overlapping nav items?
Trending Discussions on BottomBar

QUESTION

Set after value for DIV dynamically

Asked 2021-Jun-14 at 10:06

I have a div container that will layout each item evenly for the full width of the screen.

I would like to adjust the BACK div behind the selected input dynamically. I know in theory how to do it: do a transform: translate to #after of the BACK div. But I have no idea how to calculate the correct px value, depending on what input tag has been selected.

The codepen to view this is available here: https://codepen.io/depechie/pen/oNZagLa

The desired end result visually should be like following picture. So the BACK div ( the blue outline ) should be placed behind the selected input.

enter image description here

function openLink(link) {
  alert(link);
}
@import url("https://fonts.googleapis.com/css?family=Montserrat:400");
* {
  margin: 0;
}

html,
body {
  background: #f1f1f1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.bottombarcontainer {
  position: relative;
  width: 100vw;
  height: 100%;
  background: #66ccff;
  overflow: hidden;
}

.bottombarcontainer .bottombar {
  display: flex;
  position: absolute;
  width: 100%;
  height: 55px;
  bottom: 0;
  justify-content: space-around;
  align-items: center;
}

.bottombarcontainer .bottombar #back {
  width: 100%;
  position: absolute;
  background: white;
  height: 45px;
  bottom: 0;
  z-index: 0;
}


/* .bottombarcontainer .bottombar #back::after {
  content: "";
  display: block;
  width: 60px;
  height: 60px;
  background: #66ccff;
  border-radius: 50%;
  margin-top: -20px;
  transform: translate(5px, 0);
  will-change: transform;
  transition: transform 0.2s ease;
} */

.bottombarcontainer .bottombar input[type="radio"]:checked+.round {
  transform: translate(0, -7px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
  background: white;
}

.bottombarcontainer .bottombar input[type="radio"]:checked+.round svg {
  color: #66ccff;
}

.bottombarcontainer .bottombar input {
  display: none;
}

.bottombarcontainer .bottombar .round {
  position: relative;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  transform: translate(0, 5px);
  transition: transform 0.3s ease;
  will-change: transform;
  cursor: pointer;
  z-index: 1;
  text-align: center;
}

.bottombarcontainer .bottombar .round svg {
  height: 100%;
  color: #aaa;
  line-height: 45px;
}
<div class="bottombarcontainer">
  <div class="bottombar">
    <input type="radio" name="tap" id="t0" checked="checked">
    <label class="round" for="t0">
    <span class="icon">
            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
            <path fill="currentColor" d="M13,9H11V7H13M13,17H11V11H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" />
        </svg>
    </span>
      </label>
    <input type="radio" name="tap" id="t1" onchange="openLink('docs')">
    <label class="round" for="t1">
    <span class="icon">
      <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-list">
        <line x1="8" y1="6" x2="21" y2="6"></line>
        <line x1="8" y1="12" x2="21" y2="12"></line>
        <line x1="8" y1="18" x2="21" y2="18"></line>
        <line x1="3" y1="6" x2="3" y2="6"></line>
        <line x1="3" y1="12" x2="3" y2="12"></line>
        <line x1="3" y1="18" x2="3" y2="18"></line>
      </svg>
    </span>
    </label>
    <input type="radio" name="tap" id="t2">
    <label class="round" for="t2">
    <span class="icon">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
    <path fill="currentColor" d="M12.74,5.47C15.1,6.5 16.35,9.03 15.92,11.46C17.19,12.56 18,14.19 18,16V16.17C18.31,16.06 18.65,16 19,16A3,3 0 0,1 22,19A3,3 0 0,1 19,22H6A4,4 0 0,1 2,18A4,4 0 0,1 6,14H6.27C5,12.45 4.6,10.24 5.5,8.26C6.72,5.5 9.97,4.24 12.74,5.47M11.93,7.3C10.16,6.5 8.09,7.31 7.31,9.07C6.85,10.09 6.93,11.22 7.41,12.13C8.5,10.83 10.16,10 12,10C12.7,10 13.38,10.12 14,10.34C13.94,9.06 13.18,7.86 11.93,7.3M13.55,3.64C13,3.4 12.45,3.23 11.88,3.12L14.37,1.82L15.27,4.71C14.76,4.29 14.19,3.93 13.55,3.64M6.09,4.44C5.6,4.79 5.17,5.19 4.8,5.63L4.91,2.82L7.87,3.5C7.25,3.71 6.65,4.03 6.09,4.44M18,9.71C17.91,9.12 17.78,8.55 17.59,8L19.97,9.5L17.92,11.73C18.03,11.08 18.05,10.4 18,9.71M3.04,11.3C3.11,11.9 3.24,12.47 3.43,13L1.06,11.5L3.1,9.28C3,9.93 2.97,10.61 3.04,11.3M19,18H16V16A4,4 0 0,0 12,12A4,4 0 0,0 8,16H6A2,2 0 0,0 4,18A2,2 0 0,0 6,20H19A1,1 0 0,0 20,19A1,1 0 0,0 19,18Z" />
</svg>
    </span>
    </label>
    <input type="radio" name="tap" id="t3">
    <label class="round" for="t3">
    <span class="icon">
      <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-list">
        <line x1="8" y1="6" x2="21" y2="6"></line>
        <line x1="8" y1="12" x2="21" y2="12"></line>
        <line x1="8" y1="18" x2="21" y2="18"></line>
        <line x1="3" y1="6" x2="3" y2="6"></line>
        <line x1="3" y1="12" x2="3" y2="12"></line>
        <line x1="3" y1="18" x2="3" y2="18"></line>
      </svg>
    </span>
    </label>
    <div class="div" id="back"></div>
  </div>
</div>

ANSWER

Answered 2021-Jun-14 at 10:06

Simply add a border on the selected element ?

 .bottombarcontainer .bottombar input[type="radio"]:checked + .round {
  transform: translate(0, -7px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
  background: white;
  border:8px solid #66ccff ;
}

Source https://stackoverflow.com/questions/67967906

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install BottomBar

By default, the tabs don't do anything unless you listen for selection events and do something when the tabs are selected.

Support

Feel free to create issues and pull requests. When creating pull requests, more is more: I'd like to see ten small pull requests separated by feature rather than all those combined into a huge one.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.