63 lines
2.6 KiB
JavaScript
63 lines
2.6 KiB
JavaScript
function myFunction(x) {
|
|
x.classList.toggle("change");
|
|
}
|
|
window.onscroll = function() {scrollFunction()};
|
|
|
|
function scrollFunction() {
|
|
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
|
|
document.getElementById("myBtn").style.display = "block";
|
|
} else {
|
|
document.getElementById("myBtn").style.display = "none";
|
|
}
|
|
}
|
|
function topFunction() {
|
|
document.body.scrollTop = 0;
|
|
document.documentElement.scrollTop = 0;
|
|
}
|
|
/* When the user clicks on the button,
|
|
toggle between hiding and showing the dropdown content */
|
|
function myDropdownFunc() {
|
|
document.getElementById("myDropdown").classList.toggle("show");
|
|
}
|
|
|
|
// Close the dropdown if the user clicks outside of it
|
|
window.onclick = function(e) {
|
|
if (!e.target.matches('.dropbtn')) {
|
|
var myDropdown = document.getElementById("myDropdown");
|
|
if (myDropdown.classList.contains('show')) {
|
|
myDropdown.classList.remove('show');
|
|
}
|
|
}
|
|
}
|
|
jQuery(document).ready(function (e) {
|
|
function t(t) {
|
|
e(t).bind("click", function (t) {
|
|
t.preventDefault();
|
|
e(this).parent().fadeOut()
|
|
})
|
|
}
|
|
e(".dropdown-toggle").click(function () {
|
|
var t = e(this).parents(".button-dropdown").children(".dropdown-menu").is(":hidden");
|
|
e(".button-dropdown .dropdown-menu").hide();
|
|
e(".button-dropdown .dropdown-toggle").removeClass("activee");
|
|
e(".button-dropdown").css('background-color', '#187f7e');
|
|
e(".button-dropdown .dropdown-toggle *").css('color', '#ffffff');
|
|
if (t) {
|
|
e(this).parents(".button-dropdown").children(".dropdown-menu").toggle().parents(".button-dropdown").children(".dropdown-toggle").addClass("activee");
|
|
e(this).parents(".button-dropdown").children(".dropdown-menu").toggle().parents(".button-dropdown").css('background-color', '#ffffff');
|
|
e(this).parents(".button-dropdown").children(".dropdown-menu").toggle().parents(".button-dropdown").children(".dropdown-toggle").children("*").css('color', '#187f7e');
|
|
}
|
|
});
|
|
e(document).bind("click", function (t) {
|
|
var n = e(t.target);
|
|
if (!n.parents().hasClass("button-dropdown")) e(".button-dropdown .dropdown-menu").hide();
|
|
});
|
|
e(document).bind("click", function (t) {
|
|
var n = e(t.target);
|
|
if (!n.parents().hasClass("button-dropdown")) {
|
|
e(".button-dropdown .dropdown-toggle").removeClass("activee");
|
|
e(".button-dropdown").css('background-color', '#187f7e');
|
|
e(".button-dropdown .dropdown-toggle *").css('color', '#ffffff');
|
|
}
|
|
})
|
|
}); |