2A News

Empire State Lawmakers Target BB and Pellet Guns

Reading Time: 1:59 min

Just when you think anti-gunners have scraped the bottom of the barrel, along comes an even more ridiculous idea that leaves good people shaking their heads. New York lawmakers are…

View post

Texas Man Shoots Suspected Catalytic Converter Thief

Reading Time: 1:57 min

In real estate, they say that “location” is everything. The same rule, unfortunately, applies to law-abiding Americans who exercise their Second Amendment rights for self-defense. In some locales, the intended…

View post

Final Rule Ends Banking Discrimination Against Weapons Industry

Reading Time: 1:55 min

Wall Street giants in recent years have made no secret that many do not want to provide essential financial services to the firearms industry. They used the nebulous “reputational risk”…

View post

Maryland Lawmakers Send Glock Ban to Governor’s Desk

Reading Time: 1:54 min

It’s that time of year, unfortunately, when anti-Second Amendment lawmakers trot out more tired proposals intended to infringe on the right to keep and bear arms. And increasingly, state officials…

View post

Mistaken Identity Leads to Fatal Shooting by Gun Shop Employee

Reading Time: 1:56 min

In retrospect, gun shop employees are likely not the best targets for a violent criminal mob—especially when they were not even the people the group intended to confront. A worker…

View post

Florida Man Shoots Home Invasion Suspect Found in Apartment

Reading Time: 1:54 min

Just because a dangerous situation is typical, it doesn’t mean that’s how encounters with criminals will always play out. Sometimes, these critical incidents pop up when least expected, which means…

View post
<script>
  /*Source: https://github.com/Krzysztof-Antosik/Two-direction-Sticky-Sidebar*/
  
  // Verificar el ancho de pantalla al cargar y redimensionar
  function checkScreenWidth() {
    if (window.innerWidth <= 767) {
      // Si la pantalla es menor o igual a 676px, no ejecutar el código
      return;
    }

    const stickyElement = document.querySelector('.fb-sidebar__aside');
    const startPosition = stickyElement.getBoundingClientRect().top;

    let endScroll = window.innerHeight - stickyElement.offsetHeight - 500;
    let currPos = window.scrollY;
    let screenHeight = window.innerHeight;
    let stickyElementHeight = stickyElement.offsetHeight;
    let topGap = 40;
    let bottomGap = 40;

    setTimeout(() => {
      if (stickyElement.hasAttribute('data-top-gap')) {
        const dataTopGap = stickyElement.getAttribute('data-top-gap');
        topGap = dataTopGap === 'auto' ? startPosition : parseInt(dataTopGap);
      }

      if (stickyElement.hasAttribute('data-bottom-gap')) {
        bottomGap = parseInt(stickyElement.getAttribute('data-bottom-gap'));
      }
    }, 100);

    stickyElement.style.position = 'sticky';
    stickyElement.style.top = `${topGap}px`;
    stickyElement.style.height = 'fit-content';

    function positionStickySidebar() {
      endScroll = window.innerHeight - stickyElement.offsetHeight - bottomGap;
      const stickyElementTop = parseInt(stickyElement.style.top.replace('px', ''));

      if (stickyElementHeight + topGap + bottomGap > screenHeight) {
        if (window.scrollY < currPos) {
          if (stickyElementTop < topGap) {
            stickyElement.style.top = `${stickyElementTop + currPos - window.scrollY}px`;
          } else if (stickyElementTop >= topGap && stickyElementTop !== topGap) {
            stickyElement.style.top = `${topGap}px`;
          }
        } else {
          if (stickyElementTop > endScroll) {
            stickyElement.style.top = `${stickyElementTop + currPos - window.scrollY}px`;
          } else if (stickyElementTop < endScroll && stickyElementTop !== endScroll) {
            stickyElement.style.top = `${endScroll}px`;
          }
        }
      } else {
        stickyElement.style.top = `${topGap}px`;
      }
      currPos = window.scrollY;
    }

    function stickyElementToMe() {
      stickyElement.style.top = `${topGap}px`;
    }

    function updateSticky() {
      screenHeight = window.innerHeight;
      stickyElementHeight = stickyElement.offsetHeight;
      positionStickySidebar();
    }

    setTimeout(() => {
      window.addEventListener('resize', () => {
        currPos = window.scrollY;
        updateSticky();
      });

      document.addEventListener('scroll', updateSticky, {
        capture: true,
        passive: true
      });
    }, 1000);
  }

  // Verificar el ancho de pantalla al cargar y redimensionar
  window.addEventListener('load', checkScreenWidth);
  window.addEventListener('resize', checkScreenWidth);
</script>