1
I’m trying to make a pop-up, but it’s making a mistake fadeIn is not a function at HTMLAnchorElement
, because I use that jquery
via Cdn because of the bootstrap:
src="https://code.jquery.com/jquery-3.3.1.slim.min.js" Integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="Anonymous"
The intention was to display this box when passing with the mouse pointer on top of the image, which is what I get with this jquery:
src="https://code.jquery.com/jquery-3.4.1.min.js" Integrity="sha256-Csxorxvzctkaix6yvo6hppczgetbymgwsflbw8hfcjo=" crossorigin="Anonymous"
with this above I can accomplish what I want and it was the one I used here, even you will notice some class names of the bootstrap
Follows the code:
.container {
width: 50%;
float: left;
}
.img-call-popup {
width: 30%;
height: 200px;
border: 1px solid #fff;
display: inline-block;
border-radius: 30%;
}
.popup-container {
width: 100%;
height: 300px;
}
.popup-box {
position: absolute;
margin: 0 33%;
width: 420px;
height: 200px;
background-color: rgb(221, 221, 221);
padding: 20px 40px;
z-index: 1000;
margin: auto;
top: 0; left: 0; bottom: 0; right: 0;
display: none;
}
.popup-box div {
clear: both;
}
.popup-box h3 {
display: inline;
}
.popup-box nav.close {
float: right;
font-size: 20px;
color: #000000;
background:green;
z-index: 9999;
}
<body>
<div class="container">
<a href="" style="" class="hover-popup"><img src="https://picsum.photos/id/372/200/200" class="ml-4 img-call-popup"></a>
<section class="popup-container">
<div class="popup-box">
<h3>Lorem Ipsum</h3>
<nav class="close">×</nav>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
</section>
</div>
<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script type="text/javascript">
$(function() {
var self = $('.hover-popup');
self.mouseover(function () {
self.next().children('.popup-box').fadeIn(350);
});
self.mouseout(function () {
self.next().children('.popup-box').fadeOut(350);
});
});
</script>
</body>
Can I import both versions of lib into my project? Or how could I pass the code to the lib that the bootstrap
uses?
The problem is that I am using bootstrap via Cdn, this slim is the one that bootstrap recommends there. Will removing this slim bootstrap work well? will maintaining the two versions result in some conflict?
– Lucas Inácio
@Lucasinácio I just edited the answer , look at the end there what I left. BS itself says that there is no problem in using the full version ;)
– hugocsl
thanks man, it was this doubt that I had, I am not knowing how to research things well, I ask some questions well beastas hehe, but thanks for the answer!
– Lucas Inácio
@Normal lucasinácio, when we are not used to the framework is like that, but with time we get cudo rss. Abs
– hugocsl