Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery .on() method

0 votes
12 views
added Jun 29 in jQuery by LC Marshal Lieutenant (14,830 points)
edited Jul 12 by LC Marshal
$('.mydiv span').on('click', function(){
  console.log( $( this ).text());
});

2 Responses

0 votes
responded Jun 29 by LC Marshal Lieutenant (14,830 points)
edited Jul 12 by LC Marshal
var moreNearby = $('.project-nearby .nearby-more');
    moreNearby.on('show.bs.collapse', function() {
      $(this).siblings('.more-link').find('.fa').toggleClass('fa-angle-down fa-angle-up');
    });
    moreNearby.on('hidden.bs.collapse', function() {
      $(this).siblings('.more-link').find('.fa').toggleClass('fa-angle-up fa-angle-down');
    });
0 votes
responded Jun 29 by LC Marshal Lieutenant (14,830 points)
edited Jul 12 by LC Marshal
$(window).on('load scroll', function() {
  var headerTop = $('.header-top'),
      body = $('body');
  if(body.is('.page-agent-search, .page-agent, .area-outlook-landing, .project-outlook-landing, .page-node-15, .page-transaction, .page-edgehome2k18')){
    if ($(document).scrollTop() > 50) {
      $('.header-top').addClass('header-color');
    }
    if ($(document).scrollTop() < 50) {
      $('.header-top').removeClass('header-color');
    }
  }    
});
lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...