xxxxxxxxxx
// this worked for me
https://www.workversatile.com/jquery-to-javascript-converter/
xxxxxxxxxx
$('textarea#champ').keyup(updateCount);
$('textarea#champ').keydown(updateCount);
function updateCount() {
var Length = $("textarea#champ").val().length;
var AmountLeft = maxLen - Length;
$('#restants').text(AmountLeft);
if(Length > maxLen){
$('#restants').addClass("red");
$("button#tweet").attr('disabled', 'disabled');
}
else {
$('#restants').removeClass("red");
$("button#tweet").removeAttr('disabled', 'disabled');
}
}
xxxxxxxxxx
// Cache our vars for the fixed sidebar on scroll
var $sidebar = $('#sidebar-nav');
// Get & Store the original top of our #sidebar-nav so we can test against it
var sidebarTop = $sidebar.position().top;
// Edit the `- 10` to control when it should disappear when the footer is hit.
var blogHeight = $('#content').outerHeight() - 10;
// Add the function below to the scroll event
$(window).scroll(fixSidebarOnScroll);
// On window scroll, this fn is called (binded above)
function fixSidebarOnScroll(){
// Cache our scroll top position (our current scroll position)
var windowScrollTop = $(window).scrollTop();
// Add or remove our sticky class on these conditions
if (windowScrollTop >= blogHeight || windowScrollTop <= sidebarTop){
// Remove when the scroll is greater than our #content.OuterHeight()
// or when our sticky scroll is above the original position of the sidebar
$sidebar.removeClass('sticky');
}
// Scroll is past the original position of sidebar
else if (windowScrollTop >= sidebarTop){
// Otherwise add the sticky if $sidebar doesnt have it already!
if (!$sidebar.hasClass('sticky')){
$sidebar.addClass('sticky');
}
}
}
xxxxxxxxxx
$('.moveNextCarousel').click(function(e){
e.preventDefault();
e.stopPropagation();
$('.carousel').carousel('next');
});
xxxxxxxxxx
$(document).ready(function () {
$('#menu').click(function () {
$(this).toggleClass('fa-times');
$('header').toggleClass('toggle');
});
$(window).on('scroll load', function () {
$('#menu').removeClass('fa-times');
$('header').removeClass('toggle');
if($(window).scrollTop() > 0){
$('.top').show();
}else{
$('.top').hide();
}
});
$('a[]href*="#"]').on('click',function (e) {
e.preventDefault();
$('html, body').animate({
scrolltop : $($(this).attr('href')).offset().top,
},
500,
'linear'
);
});
});
xxxxxxxxxx
$(".box-toggle").on("click", function() {
if($(this).parent('.upm_poles').hasClass('active'))
{
$(this).parent('.upm_poles').removeClass('active');
}else{
jQuery(".upm_poles").removeClass('active');
$(this).parent(".upm_poles").toggleClass("active");
}
return false;
});
xxxxxxxxxx
(function( $ ){
//Define o padding top do body
var altura = $('.wpbf-page-header').height();
//Eventos do scroll
$(window).scroll(function(){
var topPos = $(this).scrollTop();
if(topPos > 100){
var novaaltura = $('.wpbf-page-header').height();
$('body').css('padding-top', novaaltura+'px');
$('.wpbf-pre-header').slideUp();
$('.wpbf-logo img').css('width', '50%');
}else{
$('body').css('padding-top', altura+'px');
$('.wpbf-pre-header').slideDown();
$('.wpbf-logo img').css('width', '100%');
}
});
var data = new Date();
$('#ano').html(data.getFullYear());
$('#btn-whatsapp .elementor-icon').click(function(){
$('.joinchat').addClass('joinchat--chatbox');
});
$('.joinchat__close').click(function(){
$('.joinchat').removeClass('joinchat--chatbox');
});
})( jQuery );
xxxxxxxxxx
var wrap = $("#wrap");
wrap.on("scroll", function(e) {
if (this.scrollTop > 147) {
wrap.addClass("fix-search");
} else {
wrap.removeClass("fix-search");
}
});
xxxxxxxxxx
document.querySelectorAll("input")[1].click();
var image = document.getElementsByTagName("img")[0];
image.setAttribute('src', './img/denzel.jpg');
image.setAttribute('width', '200px');
document.getElementById("h3").innerHTML = "Hoooooray, Good JOB";
const button = document.querySelectorAll("button");
for (var i = 0; i < 6; i++) {
if (parseInt(i % 2) === 0) {
button[i].style.color = "#0000FF";
} else {
button[i].style.color = "#FF0000";
}
}
xxxxxxxxxx
$(document).ready(function () {
$('#dtBasicExample').DataTable({
"searching": false // false to disable search (or any other option)
});
$('.dataTables_length').addClass('bs-select');
})