Reputation: 539
I wanted to add a jquery FadeOut effect to a badge but the problem is the (effect or the function) needs the minified version (the full one) so I replaced the slim CDN with the full version (3.5.0) CDN and then the bootstrap 4 ( collapse class ) stopped working.
code:- include
<head>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
<!-- Bootstrap CDN Font-awesome -->
</head>
<body>
<!-- Bootstrap Jquery JavaScripts -->
<script src="https://code.jquery.com/jquery-3.5.0.min.js" integrity="sha256-xNzN2a4ltkB44Mc/Jz3pT4iU1cmeR0FkXs4pru/JxaQ=" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
<!-- Bootstrap Jquery JavaScripts -->
collapse code and fadeOut:-
<script>
function badgefade(){
// document.getElementById("").
$("#notificationsBadge").fadeOut("slow");
}
</script>
<div class="collapse" id="'.$item['companyexported'].'"> ..... </div> ---- Collapse Not Working
<a class="nav-link" href="#" id="notificationsdrop" onclick="badgefade()" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
2:- I remember I have another issue in (Onclick) attribute the function is only triggered once what I'm trying to do is replace font awesome icon onclick
code->
<script>
function arrow(){
if (document.getElementById("arrow").className = "fa fa-arrow-down") {
document.getElementById("arrow").className = "fa fa-arrow-up";
} else {
document.getElementById("arrow").className = "fa fa-arrow-down";
}
}
</script>
<h3><a class="btn btn-success billbtn" onclick="arrow()" data-toggle="collapse" style="width: 280px !important;"href="#'.$item['companyexported'].'" aria-expanded="false" style="direction:RTL;"aria-controls="contentId"><i id="arrow" class="fa fa-arrow-down" style="float:left" aria-hidden="true"></i><span class="badge badge-light">'.$item['accountid'].'</span> فاتورة ('.$item['companyexported'].')</a></h3>
Upvotes: 2
Views: 1457
Reputation: 1
Jquery 3.5.1 has been released.It fixes the issue with collapse in bootstrap 4.4.1 https://github.com/twbs/bootstrap/issues/30553
Upvotes: 0
Reputation: 2603
The missing is popper.min.js as correctly pointed out by Rusty
Include the below script in the same order as mentioned:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
Hope this helps
Upvotes: 3