AngularJS is used to vertically collapse three different div elements. This feature

I am facing an issue with the design of my page that contains three panels. Two of these panels have tables, and when viewing the page on a smaller display, it disrupts the layout. I am wondering if there is a way to add collapsible buttons to the panels so users can collapse the ones they do not need on smaller screens.

Below is my HTML code:

<div class="row">
    <div class="col-md-2">
        <div class="hpanel hblue">
            <div class="panel-heading" translate>
                Factory
            </div>
            <div class="panel-body">

                <img file-url="logo" thumbnail="true" class="img-logo" ng-show="logo"/>
            </div>
        </div>
    </div>


    <div class="col-md-4">
        <div class="hpanel hblue">
            <div class="panel-heading" translate>
                Factory centers
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover" ng-table="centersTable">

                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-6">
            <div class="hpanel hblue">
                    <div class="panel-heading" translate>
                        Factory services
                    </div>
                    <div class="panel-body">
                        <div class="table-responsive">
                            <table class="table table-striped table-bordered table-hover nowrap" ng-table="servicesTable">

                            </table>
                        </div>
                    </div>
                </div>
        </div>
</div>

I would appreciate it if the collapse button could be located in the panel-heading at the right place. When clicked, it should hide the panel, and clicking again should open it up. I have searched online for solutions but haven't found anything helpful yet. P.S. I am using AngularJS, which might be crucial for this problem. Can someone please assist me with resolving this issue?

Answer №1

I have embedded the tr tag and td tag within the table tag

Additionally, I have applied CSS (margin-top or margin-bottom) to the respective Div

You can review the code below:

var app = angular.module('myApp', []);
app.controller('customersCtrl', function() {

});
table, th , td  {
  border: 1px solid grey;
  border-collapse: collapse;
  padding: 5px;
}
table tr:nth-child(odd) {
  background-color: #f1f1f1;
}
table tr:nth-child(even) {
  background-color: #ffffff;
}
.marginTop{
margin-top:25px;
}
.marginBottom{
margin-bottom:25px;
}
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

<body>
    <div ng-app="myApp" ng-controller="customersCtrl">
        <div class="row">
            <div class="col-md-2">
                <div class="hpanel hblue">
                    <div class="panel-heading" translate>
                        Factory
                    </div>
                    <div class="panel-body">
                        <img file-url="logo" thumbnail="true" class="img-logo" ng-show="logo" />
                    </div>
                </div>
            </div>
            <div class="col-md-4 marginTop">
                <div class="hpanel hblue">
                    <div class="panel-heading" translate>
                        Factory centers
                    </div>
                    <div class="panel-body">
                        <div class="table-responsive">
                            <table class="table table-striped table-bordered table-hover nowrap" ng-table="servicesTable">
                                <tr>
                                    <td>your table1 data1</td>
                                    <td><button>button1</button></td>
                                </tr>
                                <tr>
                                    <td>your table1 data2</td>
                                    <td><button>button2</button></td>
                                </tr>
                                <tr>
                                    <td>your table1 data3</td>
                                    <td><button>button3</button></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-6 marginTop">
                <div class="hpanel hblue">
                    <div class="panel-heading" translate>
                        Factory services
                    </div>
                    <div class="panel-body">
                        <div class="table-responsive">
                            <table class="table table-striped table-bordered table-hover nowrap" ng-table="servicesTable">
                                <tr>
                                    <td>your table2 data1</td>
                                    <td><button>button1</button></td>
                                </tr>
                                <tr>
                                    <td>your table2 data2</td>
                                    <td><button>button2</button></td>
                                </tr>
                                <tr>
                                    <td>your table2 data3</td>
                                    <td><button>button3</button></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>

</html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

I am experiencing issues with a few of my design choices not functioning correctly

I am facing issues with some of my styles. I have put in a lot of effort, but there seems to be a problem with my menu. The last part of my CSS is not functioning correctly. When hovering over the menu content, I want it to turn black and... #site_menu { ...

Click on an element using jQuery to apply a specific class to all other similar

I am looking to dynamically add a class to a DIV after clicking on an A element with the same class. Here is an example: <ul> <li><a href="#1" class="test1">1</a></li> <li><a href="#2" class="test2">2</a>< ...

An error occurred: [object Object] does not support the 'popup' method

I've been attempting to close the jQuery popup by using $('#partsPopup').popup("close"); However, I encountered an error stating that there is no method called "popup". Below is the sequence of scripts that I have followed. Any assistance wo ...

AngularJS Element Connections

I have the following component: (function () { "use strict"; angular.module("application_module") .component('tab', { controller: 'TabCtrl', templateUrl: 'app/component/application/app-heade ...

I'm attempting to render HTML emails in ReactJS

I have been attempting to display an HTML page in React JS, but I am not achieving the same appearance. Here is the code snippet I used in React JS: <div dangerouslySetInnerHTML={{ __html: data }}/> When executed in regular HTML, the page looks lik ...

What could be the reason that my Bootstrap dropdown menu is not appearing on my website

I am currently utilizing Angular in my project. I have incorporated bootstrap and jQuery via NPM install, and specified them as dependencies in angular.json. The navbar on my site contains a dropdown menu. When I hover over the dropdown menu, it should di ...

Step-by-step guide for implementing LoadGo animation with HTML

I'm in the process of loading my logo on my website's homepage. I found a LoadGo animation that I want to use, which can be downloaded Here Currently, the logo is set to load when a button is clicked. However, I would like it to load automatical ...

Unraveling HTML elements within a string using MongoDB: A step-by-step guide

Currently, I am in the process of creating a blog from scratch as a way to enhance my skills. The posts' content is stored as a long string in MongoDB with some random HTML tags added for testing purposes. I am curious about the conventional method fo ...

I am interested in developing a program using Javascript or JQuery that can effectively capture the anchor text within <a></a> link tags

I want to automatically capture the link on my website and create a system where, when users click on a specific link, it opens the captured link in a new tab without requiring browser permission and replaces the current tab with a different link. For exa ...

The CSS border on a div has inexplicably ceased functioning in Chrome, yet continues to work perfectly in

Just a moment ago, something strange happened while I was working on my memory game. After reopening the page, the borders around the divs stopped showing up when navigating with the keyboard arrows. (Click in the window to activate the arrow keys.) Normal ...

How to troubleshoot passing json data from a controller to an AngularJS directive

I recently started learning AngularJS and I'm facing an issue with passing JSON data from the controller to a directive. When I try to display the data, nothing shows up and I encounter the following errors: 1. Uncaught SyntaxError: Unexpected token ...

Is there a different way to invoke PHP within JavaScript?

Is it possible to include PHP code in JavaScript? I have come across information stating that this practice is not recommended: document.getElementById('id1').innerHTML="<?php include my.php?>"; If including PHP directly in JavaScript is ...

Personalizing the React Bootstrap date picker

I am currently working on customizing the react-bootstrap-daterangepicker to achieve a specific look: My goal is to have distinct background colors for when dates are selected within a range and when the user is hovering over dates to make a selection. I ...

Steps for serving audio files in a Spring Boot application

Can someone advise on the best location to place my audio folder in order to reference it as src="audio/audio_name" within an HTML audio tag? I attempted placing it in the resources folder, but when using src="http://localhost:9191/resource ...

The challenge of Angular form data binding

I'm encountering an issue with binding an input box to a controller in Angular. Despite following tutorials, the model never updates when I access the property or check the scope using AngularJS Batarang. Upon form submission, $scope.licenceKey remai ...

Do Scss mixins have the ability to adapt to different screen sizes

In my CSS, I set different font sizes for different devices: For example: @media only screen and (min-width: 480px) and (max-width: 599px) { t-heading { font-size:14px; } } @media only screen and (min-width: 600px) { t-heading { font-size:24px; } } I ...

What is the best way to combine two AngularJS apps on a single Express server?

I have scoured the internet to find solutions for my specific problem, but none seem to work quite right. I am attempting to serve two separate AngularJS apps based on incoming subdomains using express-subdomain with express. While the code seems to serve ...

How can I set the text to be in the center of a VML

For my email template, I need to center text over an image. Although I attempted a solution from this source, the image is not being displayed. Below is the code snippet: <div align="center" style="margin: 0; padding: 0;"> <table border="0" c ...

I am looking to create a split div with a diagonal line running through

Is there a way I can create this Mockup using html5 and css3, but also add diagonal lines to divide the div? Any suggestions on how to achieve this? ...

Having trouble displaying Json data on an HTML page?

I am trying to incorporate a local JSON file into an HTML page using JavaScript. I have successfully loaded the data from the JSON file into the console, but I'm encountering issues when trying to display it on the HTML page. Could someone please revi ...