Suggestions for improving the smoothness of the Bootstrap toggle hide/show feature

Recently completed my bootstrap toggle hide/show feature and everything seems to be functioning correctly, except for the transition between the different contents. The borders appear jagged and not smooth when activating the toggle.

I suspect there may be something unusual with the script causing this issue. I'm unsure how to resolve it, so I'm hoping someone can assist me.

$('.testver a i').on('click', function(e) {
  var currTarget = $(this).closest('a').data('target').substr(1);
  $('#leftpanel').find('[id^="demo"]').not(currTarget).collapse('hide');
});
#leftpanel {position: relative; }
#leftpanel h1 {font-size: 18px; font-family: 'Montserrat bold'; color:#b0a887; border-top: 1px solid #eee; font-style: normal;}
#leftpanel h2 {font-size: 18px; font-family: 'Montserrat bold'; color:#b0a887;  font-style: normal;}
#leftpanel a {margin-left: 230px; position: relative; top: -40px; right: -100px;}
#demo1, #demo2, #demo3, #demo4 { color: #333; font-size: 14px; margin-top: -40px; margin-right: 5px; font-family: 'Myriad Pro 31655';}



.collapse {}
.testver { width: 370px;}

.testver hr {


}

.fa-angle-up {
  display: none;
}

.testver i {

}

 .testver .fa {
   right:
 }

 .arrow[aria-expanded="true"] .fa-angle-up {
   display: inline-block;
 }

  .arrow[aria-expanded="true"] .fa-angle-down {
   display: none;
 }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<div id="leftpanel">
                <div class="testver">
                    <h1>Never seen before</h1>


                    <a href="javascript:void(0);" class="arrow" data-toggle="collapse" data-target="#demo1">
                        <i class="fa fa-angle-down"><img src="https://cdn3.iconfinder.com/data/icons/faticons/32/arrow-down-01-128.png" width="40" height="40"></i>
                        <i class="fa fa-angle-up"><img  src="https://cdn3.iconfinder.com/data/icons/faticons/32/arrow-up-01-128.png" width="40" height="40"></i>
                    </a>
                    <div id="demo1" class="collapse in" aria-expanded="true">
                        text
                    </div>
                    <hr>
                </div>
                <div class="testver">
                    <h2>Art and technology</h2>


                    <a href="javascript:void(0);" class="arrow" data-toggle="collapse" data-target="#demo2">
                        <i class="fa fa-angle-down"><img src="https://cdn3.iconfinder.com/data/icons/faticons/32/arrow-down-01-128.png" width="40" height="40"></i>
                        <i class="fa fa-angle-up"><img  src="https://cdn3.iconfinder.com/data/icons/faticons/32/arrow-up-01-128.png" width="40" height="40"></i>
                    </a>
                    <div id="demo2" class="collapse">
                        text
                    <hr>
                </div>
                <div class="testver">
                    <h2>Authenticity</h2>


                    <a href="javascript:void(0);" class="arrow" data-toggle="collapse" data-target="#demo3">
                        <i class="fa fa-angle-down"><img src="https://cdn3.iconfinder.com/data/icons/faticons/32/arrow-down-01-128.png" width="40" height="40"></i>
                        <i class="fa fa-angle-up"><img  src="https://cdn3.iconfinder.com/data/icons/faticons/32/arrow-up-01-128.png" width="40" height="40"></i>
                    </a>
                    <div id="demo3" class="collapse">
                        text
                    </div>
                    <hr>
                </div>
                <div class="testver">
                    <h2>Level of detail</h2>


                    <a href="javascript:void(0);" class="arrow" data-toggle="collapse" data-target="#demo4">
                        <i class="fa fa-angle-down"><img src="https://cdn3.iconfinder.com/data/icons/faticons/32/arrow-down-01-128.png" width="40" height="40"></i>
                        <i class="fa fa-angle-up"><img  src="https://cdn3.iconfinder.com/data/icons/faticons/32/arrow-up-01-128.png" width="40" height="40"></i>
                    </a>
                    <div id="demo4" class="collapse">
                        text
                    </div>
                    <hr>
                </div>
            </div>
            </div>

Answer №1

The reason for this issue is the use of margin-top:-40px

To fix this problem, try using a different approach like adding margin-bottom: -20px to your <h1> and removing the line top: -40px from <a>

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

PHP updating data in a MySQL database

I've been using easyPHP and encountering issues with updating records in my database. Whenever I try to update, the HTML form displays and instead of updating the data. However, it does print "Updated dat ...

The ultimate guide to loading multiple YAML files simultaneously in JavaScript

A Ruby script was created to split a large YAML file named travel.yaml, which includes a list of country keys and information, into individual files for each country. data = YAML.load(File.read('./src/constants/travel.yaml')) data.fetch('co ...

Collection of categories within the drop-down menu

I'm currently utilizing Twitter Bootstrap and would like to create a collection of concealed fields within a dropdown menu: <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"> Export <b class="ca ...

What is the most effective way to save numerical information to a file?

Imagine a scenario where there is an array filled with one million random numbers: [ 0.17309080497872764, 0.7861753816498267, ...] The task at hand is to store these numbers onto a disk for future retrieval. While storing them in text formats like JSON or ...

specifications for markers in google maps using json

Recently, I encountered a json file with the following structure: { total: 86, success: true, "rows": [ {"a1_id":"3231VB8", and so forth. The issue arises when trying to enter markers into Google Maps using jQuery from this json file. It seems like it req ...

None of the angular directives are functioning properly in this code. The function attached to the submit button is not executing as expected

I've experimented with various Angular directives in this code, but none seem to be functioning properly. I'm wondering if a library file is missing or if there's some issue within the code itself, potentially related to the jQuery file. The ...

What is the process of uploading a video and showcasing it on an HTML page?

I have successfully uploaded images and displayed them on an HTML page. Now, I am looking to do the same for videos. Here is my current code: $('#addPhotosBtn').click(function() { $(this).parents().find('#addPhotosInput').click(); }) ...

Designing an interactive region using HTML, CSS, and JavaScript

I recently created this code with some assistance: When I tried to format the code, it all ended up on one line and looked unreadable. To view the code properly, please visit this link: http://jsfiddle.net/QFF4x/ <div style="border:1px solid black;" ...

The issue of `function.prototype` not functioning correctly when used alongside `module

I have a file that contains a current function implementation function bar(){ /*Code goes here*/ } bar.prototype.method = function(param){ /*Some code*/ return this } module.exports = bar In the test file, I encountered some issues, let y = requir ...

How to Properly Adjust the Material UI CircularProgress Size

Is there a way to display the Material UI CircularProgress component at a size that nearly fills the parent div, which has an unknown size? Ideally, I want the size to be around 0.8 * min(parent_height, parent_width). I've experimented with adjusting ...

When using Selenium to locate an element, it appears to be returning an unexpected empty object

This question has been bothering me for quite some time. I am currently using Selenium in conjunction with Python to find an element within a webpage. The specific element I am targeting is as follows: <a id="topmenu_adhocQtraditional_Reports" ...

Can you assist in resolving this logical problem?

exampleDEMO The code above the link demonstrates how to control input forms based on a button group selection. In this scenario, when a value is inputted on the 'First' Button's side, all input forms with the same name as the button group ...

li tag style

I need to insert a check mark inside the <li> tag on the right side. How can I do this? The check mark looks like this: For example: http://jsfiddle.net/HpVcy/ ul li{ padding: 3px 10px 3px 10px; background:url(http://img4up.com/up2/730897458613759 ...

Using Angular to automatically update the user interface by reflecting changes made in the child component back to the parent component

Within Angular 5, I am utilizing an *IF-else statement to determine if the authorization value is true. If it is true, then template 2 should be rendered; if false, then template 1 should be rendered. Below is the code snippet: <div *ngIf="authorized; ...

Expanding a website banner slide to fill the entire width of the page

Is there a way to ensure that the banner images in the website below flow seamlessly? Currently, it seems like the current image is cut off on the left and part of the previous image shows up in its place. I'd like the current image to occupy the ent ...

Utilize the ForEach method on an object obtained through a jQuery ajax request

I have encountered an issue where I am unable to retrieve values from a collection passed through AJAX in my webmethod using a foreach procedure. The collection variable in question is var Leave = { "Date": [], "Half": [] }; When passing Leave to the webme ...

Alter the appearance of the mouse cursor when hovering over input fields in HTML

I am working with a variety of HTML elements that can be moved via Drag'n'Drop. In order to indicate to the user where these elements can be dropped, I change the cursor's appearance using CSS classes applied through JavaScript. This method ...

Highlighting JavaScript code with React Syntax Highlighter exclusively

I've been struggling to highlight Ruby code, but it seems like no matter what I do, it keeps highlighting JavaScript instead. It's frustrating because I can't seem to get it right. import React from "react"; import atom from "node_module ...

Eliminating the nested API call within a loop

After making an API call to retrieve a set of data such as a list of users, I noticed that I am implementing a for loop and within it, I am making another API call to obtain each user's profile details based on their ID. I understand that this approac ...

Disabling Javascript in Chrome (-headless) with the help of PHP Webdriver

I am experimenting with using Chrome without JavaScript enabled. I attempted to disable JavaScript by adding the --disable-javascript command line argument. I also tried some experimental options: $options->setExperimentalOption('prefs&a ...