New Tabbing

PHOTO EMBED

Tue Jan 13 2026 13:26:20 GMT+0000 (Coordinated Universal Time)

Saved by @divyasoni23 #javascript #jquery

import $, { contains } from 'jquery';

class Property {
  constructor(element) {
    this.$element = $(element);
    this.$tabs = this.$element.find(".property--tab li");
    this.$tabsContent = this.$element.find(".property--main-row");
    this.init();
  }

  init() {
    this.$tabs.first().addClass("active");
    this.$tabsContent.hide();
    this.$tabsContent.first().show();

    this.$tabs.click((e) => {
      e.preventDefault();
      if ($(e.currentTarget).hasClass("active")) {
        return;
      }
      this.$tabs.removeClass("active");
      $(e.currentTarget).addClass("active");
      this.$tabsContent.hide();

      var activeTab = $(e.currentTarget).find("a").attr("href");
      $(activeTab).fadeIn(700);
      return false;
    });
  }
}

$('[data-property]').each((index, element) => new Property(element));
content_copyCOPY