jQuery
How to make the font-weight bold of the first word with JS?
1) Add the class firstWord to your heading or paragraph
2) You can select the first word of the text by adding a span class to it with jQuery
jQuery – Add class only to the selected item
$(document).ready(function () {
$('button').click(function () {
$("button").removeClass("selected");
$(this).addClass("selected");
});
});
jQuery – Do something if checkbox is checked
jQuery Changing Element Styles and Classes
jQuery fadeOut on scroll
jQuery(document).ready(function(){
jQuery(window).scroll(function(){
if(jQuery(this).scrollTop() > 600){
jQuery('#').fadeOut();
}
else{
jQuery('#').fadeIn();
}
});
});
Add class with jQuery when scrolling
jQuery(window).scroll(function () {
if (jQuery(document).scrollTop() > 1 ) {
jQuery('.cube-desktop').addClass('show');
} else {
jQuery('.cube-desktop').removeClass('show');
}
});
Add class only to clicked element with jQuery
jQuery(document).on('click', function() {
jQuery('.collapse').removeClass("show");
});
jQuery(".collapse").click(function(event) {
// remove classes from all
jQuery('.show').removeClass('show');
// add class to the one we clicked jQuery('.collapse', this).addBack(this).addClass("show"); event.stopPropagation();
});