<a href="https://www.timeatthebar.co.uk" target="_blank"><img id="icon-img" src="assets/img/tabicon2.png" class="position-absolute top-50 start-50 translate-middle" style="max-width:113px; top: 43%!important; z-index:0;" alt=""></a>
<a id="savethepub" class="tab-base navbar-brand navbar-brand position-absolute top-50 start-50 translate-middle" style="top: 84%!important; font-size:22px;" href="#">Save The British Pub</a>
Encountering a JQuery problem, the provided HTML code appears to be correctly set up. The script below is meant to interact with a button on the webpage. Testing indicates that the button functionality works as intended, although some CSS styles are not being applied.
var button = $( "#collapser" );
var tabimg = $( "#icon-img" );
var stp = $( "#savethepub" );
var bntclicked = false;
button.click(function() {
if (bntclicked === false) {
tabimg.css({"max-width":"70px", "top":"8%!important", "left":"21%!important", "z-index":"0"})
stp.css({"font-size":"22px", "top":"7%!important"})
bntclicked = true;
}
else if (bntclicked === true) {
tabimg.css({"max-width":"113px", "top":"43%!important", "left":"50%!important", "z-index":"0"})
stp.css({"font-size":"22px", "top":"84%!important"})
bntclicked = false;
}
});
Code for the Button:
<button id="collapser" class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>