The animation will not scroll down with the div

Having some trouble getting this div to slide down smoothly when the button is clicked. The animation seems to glitch whenever the div opens or closes.

I've attempted adding position:relative and overflow:hidden, but it doesn't seem to be doing the trick (keep in mind I'm also using Bootstrap).

$(document).ready(function(){
    $(".faqOuter").click(function(){
        $(".faqInner").slideToggle("slow");
    });
});
p{
vertical-align: middle;
margin: 0 !important;
}

.faqOuter{
color: white;
background-color: #262626;
text-align: center;
font-size: 20px !important;
height: 30px;
border: solid;
border-color: #262626;
padding: 0 0 5px 0;
}

.faqInner{
padding: 40px 35px 40px 40px !important;
position: relative !important;
border: solid;
border-color: #F3F3F3;
display: none;
overflow: hidden;
min-height: 0px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h4 class="faqOuter col-md-8 col-md-offset-2">Trial One Bar</h4>
<div class="faqInner col-md-12">
<p>Alienum phaedrum torquatos nec eu, vis detraxit periculis ex, nihil expetendis in mei.</p>
</div>

Answer №1

To improve the transition effect, it is recommended to eliminate the use of !important on padding.

$(document).ready(function() {
  $(".faqOuter").click(function() {
    $(".faqInner").slideToggle("slow");
  });
});
p {
  vertical-align: middle;
  margin: 0 !important;
}

.faqOuter {
  color: white;
  background-color: #262626;
  text-align: center;
  font-size: 20px !important;
  height: 30px;
  border: solid;
  border-color: #262626;
  padding: 0 0 5px 0;
}

.faqInner {
  padding: 40px 35px 40px 40px;
  border: solid;
  display: none;
  border-color: #F3F3F3;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<h4 class="faqOuter col-md-8 col-md-offset-2">Trial One Bar</h4>
<div class="faqInner col-md-12">
  <p>Alienum phaedrum torquatos nec eu, vis detraxit periculis ex, nihil expetendis in mei.</p>
</div>

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

The option for selection is malfunctioning

I'm brand new to jQuery and definitely not a "tumbleweed" )-; so please be patient with me. My jQuery mobile app currently sends data to an API. There are three XML documents based on daily, weekly, and monthly activities generated by the API. I nee ...

Tips for utilizing navigator.getDisplayMedia with automatic screen selection:

navigator.mediaDevices.getDisplayMedia({ audio: false, video: true }).then(gotMedia).catch(function(e) { console.log('getDisplayMedia() error: ', e); }); Triggering the above code will result in a popup like this. There is anoth ...

Group all 3 elements with a wrapper

I'm facing a challenge in trying to enclose 3 divs inside one wrapping div. I have successfully wrapped up 2 divs, but the third one is proving to be difficult. To see my progress so far, you can check out my JSFiddle here: http://jsfiddle.net/cz9eY/ ...

What could be causing a single image not to show up on an HTML page?

I have been searching tirelessly for a solution but cannot seem to find one. Interestingly, in my HTML document, an image appears perfectly fine when viewed from my browser. However, once I upload my website to a server host, this specific image refuses to ...

When using express, the response.sendFile() function is causing an Uncaught SyntaxError with the error message: Unexpected token <

Currently, I'm utilizing react-router with browserHistory. There is a specific function in my code that is meant to send the Index.html file since the routing is handled client-side with react-router. However, there seems to be an issue where the serv ...

The issue arises when radio buttons allow for multiple selections and labels cannot be displayed in a single row

I am facing an issue with the radio buttons displayed in the Bootstrap format. The labels for the radio buttons are not aligning on the same line as the buttons. Below is the code I am using: <div class="row"> <div class="col-lg-4&q ...

Find out the index of a div within an array

Curious about determining the position of a div in an argument? For instance, if there are multiple divs with the same name: <div class="woot"></div> <div class="woot"></div> <div class="woot"></div> <div class="woot ...

Extract website addresses from a text and store them in an array

I am currently attempting to extract URLs from a string and store them in an array. I have implemented a node module to assist with this task. const getUrls = require("get-urls") url = getUrls(message.content) However, the current implementation fails to ...

Customize JqGrid Edit/Delete button CSS style

Within my JQGrid, I have successfully implemented Edit and Delete buttons that redirect users to another page for editing or deleting specific records. However, I am facing a CSS issue with the styling of these buttons. How can I override the current style ...

The Scrapy CSS selector is not fetching any prices from the list

Having trouble with the price CSS-selector while scraping an interactive website using Scrapy. Check out the HTML screenshot I captured: https://i.stack.imgur.com/oxULz.png Here are a few selectors that I've already experimented with: price = respon ...

What is the best way to send two mongoose find queries to the correct GET route?

I am facing an issue with my app where I have two separate routes using app.get to render "/" and fetch data from two different MongoDB collections using mongoose find{} methods. I also have corresponding post routes that redirect the data entered in forms ...

Display the website associated with the clicked ID in an iframe upon clicking, using the information stored in the database

Present Website: view image description I've developed a website with content generated by looping through a database using php & mysql. The information displayed includes an id, names, company website, address, and image, all presented in stacke ...

Issue encountered with websocket connection while attempting to include dependencies

My current project involves integrating charts for the graphical component using React within an Electron software. I've added interaction with buttons (sections) to insert different data into the graphs based on user clicks on one of the sections. Th ...

Using Javascript to automate the organization of links based on predefined criteria is an

Picture This: A digital library full of categorized links, totaling 1000 in number. Diverse themes are covered by these links, making it a treasure trove of information. Displayed prominently at the top are buttons labeled ALL, MOBILE, CARS, BOOKS, and TE ...

Vertical positioning offset of jQuery UI selectmenu in relation to buttons on this line

When creating a form, I like to place control elements in a line such as a button, select box, and checkbox for a logical layout. However, after incorporating jQuery UI, I noticed a strange vertical alignment issue with the select box. For reference, here ...

Is there a way to locate the final element in a specific angular ng-repeat loop subset?

The final entry in the labels section may not be checked, making $last unsuitable for this scenario. This results in the following sequence: peaches, bananas, cherries, watermelon, How can I locate the last item in an angular ng-repeat loop while using an ...

Retrieve the Vue.js JavaScript file from the designated static directory

This is my inaugural attempt at creating a web application, so I am venturing into Vue.js Javascript programming as a newcomer. I have chosen to work with the Beagle Bootstrap template. Within my Static folder, I have a file named app-charts-morris.js whi ...

Add a font awesome icon dynamically using JavaScript

I'm currently working on a navigation bar in JavaScript that displays the titles of various links. However, I would like to enhance it by adding small icons next to the text. Can anyone guide me on how to integrate Font Awesome icons into my JavaScrip ...

Tips for modifying JSON property names during the parsing process

As outlined in the JSON.parse documentation, a reviver function can be utilized to modify the value of each property within the JSON data. Here is an example: JSON.parse('{"FirstNum": 1, "SecondNum": 2, "ThirdNum": 3}', function(k, v) { return ...

steps for modifying a js function/object

Hey there, I'm currently working with an API but I need to make a patch for it. Trying to fix the issue with the code below: Songapi.prototype.goPlaySong = Songapi.prototype.goPlaySong.toString().replace('["universal","emi","warner"]) !== -1&ap ...