Styling Challenges with CSS/AngularJS Accordion in Footer

I want to create a page layout as shown below:

+---------------------------+
| Auto-fill / v scrollable ^|
|                          ||
|                          ||
|                          v|
+---------------------------+
| Fixed               [][][]|
+---------------------------+
| Fixed - Collapsable       |
+---------------------------+

Where [] represents buttons.

I have a Plunk that resembles the structure above, but there are some issues:

  • (resolved) The vertical scrollbar of the Autofill area extends beyond its own area. It should stop at the next section.
  • (resolved) The header of the first accordion group (with the buttons) does not occupy its full space and/or the buttons go outside of the header.
  • Since I set a max height for the 'Fixed - Collapsable' area, I need an automatic vertical scrollbar.

Minor issue:

  • The spacing between accordion groups is too large.
  • Buttons are not vertically centered.

Suggestions on how to address these issues would be appreciated. Thank you!

I used an accordion group for the buttons section because it was the easiest way to align it with the bottom accordion and maintain consistent styling. While correct that it shouldn't be opened with empty content, other methods to achieve this alignment are welcomed.

UPDATE

I have made updates in an updated Plunk where the footer container's height is fixed (= 250, also the max height), while allowing the maincontent container to expand and shrink accordingly.

UPDATE - part 2

I have resolved the second issue regarding the header styling:

<accordion-group is-open="false" is-disabled="true">
  <accordion-heading>
    <a ng-href="" unclickable>&nbsp;</a>
    <span class="pull-right">
        <button class="btn-xs btn-primary">Save</button>
        <button class="btn-xs btn-primary">Cancel</button>
        <button class="btn-xs btn-primary">Close</button>
    </span>
  </accordion-heading>
</accordion-group>

In the code snippet, I added is-disabled="true" to ensure the accordion cannot be opened.

To address the partially filled background due to lack of content, I inserted a non-breaking space. However, hovering over it may display the 'hand' cursor, so I implemented a directive to change the cursor to 'default' upon hover:

app.directive("unclickable", function () {
      return {
          restrict: "A",
          scope: false,
          controller: function ($scope, $element) {
              $element.bind("click", function () {
                document.getElementById("top").focus();
              });
              $element.bind("mouseover", function () {
                  $element.css("cursor", "default");
              });
          },
          link: function ($scope, $elem, $attrs) {
          }
      }
  });

One minor issue: Clicking the non-breaking space sets focus on it, but resetting focus on click does not work.

Answer №1

To resolve the issue with the vertical scrollbar, you can apply the position: fixed property to your .maincontent element. Here is an example of how you can do this:

.maincontent {
  position:fixed;
  top: 40px;
  bottom: 85px;
  right: 0;
  left: 0;
  overflow: auto;
}

You can then adjust the values for top and bottom based on the size of your header/footer.

UPDATE:

In the scenario mentioned, the entire document is currently scrolling due to the full window height which results in a scrollbar covering the whole page. To limit the scroll functionality to a specific element, such as .maincontent, you can utilize the overflow: auto property. This will confine the scrollbars within the div (docs). The rest of the code involves fixing the positioning to fill the remaining space within your layout.

Answer №2

Here is the CSS code you need to include:

   .align-right
{

   position:sticky;
}

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

What is the most efficient way to execute useEffect when only one specific dependency changes among multiple dependencies?

My main objective is to update a state array only when a specific state (loadingStatus) undergoes a change. Yet, if I include solely loadingStatus as a dependency, React throws an error requesting all dependencies [loadingStatus, message, messageArray, set ...

Is there a way to deactivate the spin buttons for an input number field?

Is there a way to create an input element with type number in Vue using createElement() in TypeScript and then disable the spin buttons for increment and decrement? I attempted to use the following CSS: input[type=number]::-webkit-inner-spin-button, input ...

Receiving a 404 error when attempting to use the 'import' statement within a script tag labeled as a module

I am currently working on a NodeJS project that utilizes Webpack for bundling and Express for serving. Whenever a user visits the root domain, they are served an index.html file containing a <script> block in the footer with a type of module. index. ...

Error encountered: $(...).pickadate is not defined as a function

I am currently working on a basic web project that involves a simple form where users enter their name, birthday, and university degree. I am utilizing Materialize and jQuery for this project. However, I have encountered a frustrating issue while trying to ...

Incorporate JavaScript files into your Gruntfile

I utilized a bootstrap-compass project by using the yeoman generator provided in this link: https://www.npmjs.com/package/generator-bootstrap-compass You can view the file structure through the link mentioned above. Now, I am looking for guidance on cor ...

Modify the image inside a div when hovering

How can I create a product card that displays thumbnails of images when hovered over, and changes the main image to the thumbnail image? My current challenge is getting this functionality to work individually for each card on an e-commerce site. Currently, ...

Python Selenium- Extract and print text from a dynamic list within a scrolling dropdown element

I am currently working on a project using Selenium and Python to extract a list of company names from a dropdown menu on a javascript-driven webpage. I have successfully managed to reveal the list of company names by clicking the navigation button, and eve ...

Using Express for Managing Subdomains, Redirects, and Hosting Static Files

I am struggling to configure Express in a specific way and can't seem to get it right. Despite researching on various platforms like SO, I still can't figure it out. Hopefully, by explaining my intentions here, someone can guide me in the right d ...

The auto-play feature fails to function on iPhone devices when using Reactjs

I am currently working with Reactjs and Nextjs. I have a video on my website that is functioning properly on Android phones but not on iPhones. How can I resolve this issue? I have attempted the following code: <video loop autoplay='' muted> ...

I am attempting to retrieve JSON data in JavaScript but am seeing a null response in the action class

Having an issue with JSON data being sent through AJAX from the client side. The data is showing as null inside my action class. Here is the JSON string: {"data":[{"id":"","col":1,"row":1,"size_x":1,"size_y":1}, {"id":"","col":1,"row":2,"size_x" ...

Problem with user scalability in desktop browsers: when zooming out to 33% and lower, all CSS vanishes

Having trouble understanding why my styling disappears at 33% zoom on Chrome and even worse at 75% on IE11. <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"> <meta name="viewport" content="w ...

Verification of unique custom string

How can I ensure that a string follows the specific format of x.xx.xxxxx? The first character is mandatory, followed by a period, then two characters, another period, and finally any number of characters of varying lengths. ...

AngularJS: Unable to locate element using getElementById function

Using a third party JavaScript application, I have integrated and invoked a function within one of my AngularJS factories. This function requires the id of a DOM element as a parameter, as it manipulates this element. ThirdPartyApp.doSomething("#elementId ...

Assigning a default value to a date picker within a dynamically created form after making an AJAX call

Hey there, I've been delving into AngularJS lately. Currently, I'm working on a POST AJAX call that retrieves data which I use to create a form. Within this form, there are two input fields that serve as date pickers. I've been struggling t ...

Scrape dynamic web data with JSOUP

Having trouble grabbing the price? I cannot seem to get any output for the price and its weight. I've attempted different methods, but nothing is working Document doc = Jsoup.connect("https://www.jakmall.com/tokocamzone/mi-travel-charger-20a-output- ...

What is the process for assigning an element to a specific URL ID?

Imagine having an array of objects structured like this: [{ details: {id: 7}, type: minigame1, ...(more values that need to be accessed later) }, { details: {id: 8}, type: minigame1, ...(more values that need to be accessed later) }, { details: {id: ...

Utilize Angular.js to efficiently pass several values within the $scope object

I am a beginner in Angular.js and eager to learn more about it. I recently put together a small project and am trying to pass multiple values with the $scope object, but encountering some issues. Here is an overview of what I am attempting: function List ...

Transfer information to a different division using Ajax

I am attempting to transfer data to another div after an Ajax refresh. Each time it refreshes, new data is fetched from the database. My goal is to retain the old data displayed in the first div, store it, and then move it to the second div when Ajax refre ...

Is it possible to access the chrome://webrtc-internals/ variables through an API in JavaScript?

I couldn't find any information about how to access the logged variables in chrome://webrtc-internals/ on google. There is not even a description of the graphs available there. I am specifically interested in packetsLost, googCurrentDelayMs, and goo ...

The chosen option in the q-select is extending beyond the boundaries of the input field

Here's the code snippet I used for the q-select element: <q-select square outlined fill-input standout="bg-grey-3 text-white" v-model="unit_selection" :options="units&qu ...