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

Tips for creating a scrollable smiley input field

I have a chat system where I am incorporating smileys from a predefined list. QUERY I am looking to create a scrolling feature for the smileys similar to how it is implemented on this particular website. The twist I want to add is to have this functiona ...

On smaller device screens, the full-height sidebar and content area experience some disruption

How can I resolve the height issue with sidebar and content area on smaller devices, maintaining 100% height for both? I'm having trouble fixing it with the current code. I am aiming to create a fixed-width sidebar that expands to full width on small ...

The Textfield component in Material UI now automatically sets the default date to the current date when using the "date" type

I am using Material UI's textfield with the type set to "date" and I'm experiencing an issue where the date defaults to the current date instead of mm/dd/yyyy. Is there a way to prevent this behavior and display mm/dd/yyyy when the user loads the ...

"Bordering with Rounded Edges: A CSS Styling

Applying rounded corners to my list navigation elements using CSS. These elements also have a border. Here's how it currently appears: The quality of the rounded corner and border combination looks off, with some white shining through. Any suggesti ...

What is the best way to expand and collapse a mat-expansion-panel using a button click

Is it possible to expand a specific mat-expansion-panel by clicking an external button? I've attempted linking to the ID of the panel, but haven't had any luck... <mat-expansion-panel id="panel1"> ... </> ... <button (click)="doc ...

Interacting with my Rails API through JavaScript requests

Exploring the world of Rails and diving into creating a basic rails-api. Currently facing an issue while trying to incorporate user addition to my model using a JavaScript request... Let's take a look at my HTML file named add-user.html: <script ...

Learn how to show image information in a separate div by clicking on the image using jQuery

Is there a way to show or hide information of an image in a separate div by clicking on the image itself? $(document).ready(function () { $(".cell").click(function () { $(this).find("span").toggle("slow"); }) }); <div class="cell"> ...

The box shadow feature does not function properly when the position is set to sticky

Applying position sticky to th and td in the example below seems to be causing issues with the box shadow not working. Can anyone provide insights on why this is happening? <div class="overflow-x-auto lg:overflow-visible"> <div> <t ...

The passport authentication process is malfunctioning as there seems to be an issue with the _verify function

Having an issue and could use some assistance. I am currently implementing passport in my express application. While I am able to successfully register a user, I encounter an error when trying to log in. TypeError: this._verify is not a function at Str ...

Attempting to determine the correct callback URL for a custom login screen on Auth0

Struggling to implement a custom login screen for my Angular app locally by following this guide. The issue lies in the fact that my login callback is not being triggered. The original login URL is http://localhost:9000/#/login angular.module('myApp ...

Strategies for eliminating all elements with a particular innerHTML content

function removeElements() { let li = document.getElementsByClassName("li"); for (var i = 0; i < li.length; i++) { if (li[i].innerHTML === "hello") { li[i].parentElement.remove(); } } } <li> <span class="li">hi</sp ...

Enhance the appearance of datatables pagination with a personalized touch

I am working on a page that utilizes server-side datatables and I want to implement a custom pagination style on it: HTML <ul class="pagination pagination-danger"> <li class="page-item"><a class="page-link" href="#" data-original-title ...

Removing Access Package Assignment in Microsoft Graph

Using the Microsoft Graph API Beta version, I am attempting to delete an access package. However, in order to do so, I must first remove all assignments associated with it. As per the official documentation, I came across the accessPackageAssignment object ...

Receive File - Error 500 from Server

Getting a 500 Internal Server Error after uploading a large zip file using jQuery and CodeIgniter is causing some confusion. The progress bar completes, but the error appears in the console log without a clear reason. The strange part is that it works fine ...

Ways to delete specific data and insert a new row into a Jquery data table without disrupting the remaining rows

I have a dataset with 100 rows of information, and I need to remove specific data based on ID and add new rows for those IDs. I also want to be able to edit the existing rows based on their IDs. Below is the code snippet I am using: oCustomization : { ...

Eliminate repeated elements by comparing two sets of data

I have two arrays of data, rlT and refundT. My goal is to eliminate any duplicate items from the rlT array that have a matching transactionId in the refundT array. I came across a solution using filter() and find() on Stack Overflow: Remove all elements co ...

What are the steps to achieve form styling using Bootstrap?

I am trying to achieve a specific style using the Bootstrap framework. I have been able to achieve something similar to what I want, but the issue is that the save button is not aligned to the right and is not taking up the available width. There is a gap ...

Combining a JavaScript NPM project with Spring Boot Integration

Recently, I built a frontend application in React.js using NPM and utilized IntelliJ IDEA as my IDE for development. Additionally, I have set up a backend system using Spring Boot, which was also developed in IntelliJ IDEA separately. My current goal is t ...

`Is it possible to remove an empty frame using javascript?`

I have this script that generates a "layer" resembling a frame and I need to remove it. Here is the code for creating the layer: function disableLayer() { var layer = document.getElementsByTagName('div')[0]; d = document.createElement(& ...

Using jQuery's slideToggle feature to hide content when clicked again or when a different button is

I have a challenge with creating toggle buttons that require specific functions: 1) Display content on the first click (this is working) 2) Conceal content when another button is clicked (this is also working) 3) Hide content on the second click (this i ...