Stop the slimscroll bar in jQuery from covering the absolute positioned div underneath when zooming

I encountered an issue while working on a section of my website.

In one of the columns, I have implemented a jQuery slimscroll, along with a div (.footer) that is absolutely positioned at the bottom. It is crucial for the footer to remain at the bottom, even if the user zooms in on the page. The column is positioned relative to the top as per the design requirements. Is there a CSS-only solution to prevent the slimScroll from overlapping into the footer? Or would I need to use specific jQuery code for this purpose? How can I achieve this?

Essentially, I want the SlimScroll element to fill the .container div without encroaching on the .footer.

Fiddle: Link

Here is the HTML:

<div class="Wrapper">
<div class="container">
    <div class="content">
        <div class="message">asdasd </div>
        <div class="message">asdasda </div>
        <div class="message">asdasd </div>
        <div class="message">asdasd </div>
        <div class="message">asdasd </div>
        <div class="message">asdasd </div>
        <div class="message">asdasdasd </div>
        <div class="message">asdasdasd </div>
        <div class="message">asdasdasd </div>
        <div class="message"> asdasd</div>
        <div class="message">asdasd </div>
        <div class="message">asdasd </div>
        <div class="message">asdasd </div>
        <div class="message"> asdasd</div>
        <div class="message">asdasdasd </div>
    </div>
</div>
<div class="footer"> </div>

And the CSS:

.Wrapper {
position:relative;
height:90vh;
background-color:gray;
width: 300px;
margin:0 auto;
margin-top:50px; }

.container {
width:300px;
height:70vh;
background-color:lightgray; }

.content {
max-width:300px;
height:70vh;
position:relative;
overflow:hidden; }

.message {
border: 2px solid red;
height: 80px;
width:296px; }

.footer {
position:absolute;
background-color:cyan;
width:300px;
height:100px;
bottom:0px; }

The JQuery:

$(function(){
$('.content').slimScroll({
    height: '450px'
});
});

Thanks!

Answer №1

Have you experimented with using height : 'Auto';

Modify your function like this.

$(function(){
    $('.content').slimScroll({
        height: 'auto'
    });
});

It might be necessary to adjust the padding as well.

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

jQuery Animation: Creative Menu Icon Display

Whenever the toggle menu's navigation icon is clicked, it triggers an animation that transforms the "hamburger" icon into an "X", causing the navigation menu to drop down. If a user clicks either the navigation icon or outside of the active toggle me ...

AJAX response from open cart is returning null JSON data

Hey there, I'm having a problem with my ajax request. It seems like I keep receiving a null value for json. Let me show you the JavaScript code... <script> $(document).ready( function() { $('#donate-box-submit').on('click' ...

Include an item in a JSON structure

I have a settings.json file that contains the following data (where 123456789 represents a unique user id): { "123456789": {"button_mode":true} } My goal is to add a similar id: {button_mode: value} object to this JSON file if there is no existing en ...

Enhance the efficiency of IE driver within Selenium1

Recently, I've noticed that Selenium1 performs really well with Firefox using XPath, but it's extremely slow with IE. Is there a way to improve the performance of Selenium1 in IE? I've heard that some people use JQuery element locators in S ...

Show/Hide Section

I am struggling to implement two buttons - one for expanding a div and one for collapsing it. Despite multiple attempts to modify the code, I have not been successful. It appears that I am having trouble understanding how to prevent a link from toggling. ...

Securing the ajax php script post call

If you're looking for a detailed guide on sending emails using PHP and jQuery, check out this resource. In summary, the process involves calling a PHP script with jQuery.post(). The PHP script includes code similar to this: $to = $_REQUEST['to& ...

Having issues with displaying options in Select2 within a Vue Component?

I have successfully created a Vue component that generates options for a select dropdown as shown below: <select ref="subdomain_id" name="subdomain_id" id="newEvidenceSubdomain" class="form-control" :class=&qu ...

Is there a way to show information exclusively on the selected card upon clicking?

[click here to see image 1] https://i.sstatic.net/cfvUT.png [click here to see image 2] https://i.sstatic.net/ISXAU.png Greetings, fellow beginners! Once again I find myself stuck on a coding problem. I have fetched various workout data and displayed t ...

Highlighter for HTML - Prism

I have been using Prism for styling CSS and it's working well: <pre><code class="language-css">p { color: red }</code></pre> However, I am facing issues with highlighting HTML code: <pre><code class="language-html"& ...

The SpringMvc tiles are failing to display the header and footer

One of the main components in my project is a file called tiles.xml <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN" "http://tiles.apa ...

Exploring Vue.js: Leveraging v-bind for multiple classes in Vue.js applications

Can someone assist me in figuring out how to apply multiple options to v-bind:class? In my Uno game, I need to determine the text color of cards based on their color property stored as a list of objects like this: ([{ Color: green, Value: 6}]. Here is my ...

Adding / Deleting a Row in a sequence of floated divs

I have a group of div elements arranged side by side with the float:left style as shown below: <div id="container"> <div id=0" style="float:left">> Stuff </div> <div id=1" style="float:left">> Stuff </div> < ...

Transforming JSON objects, retrieve an empty value in place of undefined

Can someone please offer some advice on the following: I am retrieving JSON data using this code snippet: $.getJSON(jsonPath, function(returnedData){ ... }); The JSON object returned will have a structure similar to this: ... "skin": { "elapsedTextCo ...

How can we maintain line breaks in Textfields when using React-Admin and Material UI?

Currently, I am working with React-Admin and encountered an issue where my database field contains line breaks (\n). However, when I try to display it on a page using the following code: <TextField source="extra_details" /> The line breaks are ...

Disable Bootstrap's CSS3 transitions for progress bars

I'm trying to find a way to stop Bootstrap's CSS3 transitions from animating on the progress bars when I update them using javascript/jquery. Does anyone have any suggestions? I attempted to use this method mentioned here but it wasn't succ ...

Autocomplete Feature Using Django and JQuery

I'm struggling to implement an autocomplete feature in my form. Despite trying multiple tutorials, I can't seem to get it working properly. The request is being sent out successfully and I receive a 200 response. However, when inspecting the Resp ...

Prevent Phonegap from losing input focus upon closing the keyboard

Currently, I am using PhoneGap to develop a mobile application. Within my app, I have implemented a search field using . However, I am encountering an issue. When I focus on the input field, the keyboard opens and I can begin typing, triggering my script ...

Struggle with registering fonts in Canvas using JavaScript

I've been struggling to add a custom font to my canvas for hosting the bot. Even though I'm not encountering any errors, the font fails to display on the host. Below is the code snippet: const { AttachmentBuilder } = require('discord.js&apos ...

Displaying various elements with distinct properties in React using ES6

<---------------------MODIFICATION------------------------> I initially thought I needed multiple onChange functions, but after reviewing the answers provided, I discovered a solution thanks to the helpful user's response. With some experimenta ...

Checking at the end of a loop node in JavaScript by reading a file synchronously

const fileSystem = require("fs"); const data = fileSystem.readFileSync("./mytext.txt").toString('utf-8'); const lines = data.split("\n"); while(!data.atEnd()) ^ I'm trying to create a loop that continues until reaching the end of the ...