2A News

Alleged California Burglar Killed by Armed Homeowner

Reading Time: 1:38 min

Breaking into a stranger’s home is a dangerous business, one that is better left undone. An alleged burglar in California learned that lesson in the hardest way and paid the…

View post

Federal Judge Blocks California’s Approved Handgun Roster

Reading Time: 2:59 min

A major victory for gun rights emerged on Monday when a federal judge granted a preliminary injunction against a draconian California gun law. The state restricts the sale of new…

View post

Sheriff Pens Striking Letter to Residents on Gun Control

Reading Time: 3:9 min

Sheriff Troy Heck of Benton County, Minnesota, recently wrote a timely and relevant defense of Second Amendment liberties and the foolishness of new gun control laws. Simply put, violent criminals…

View post

Senators Work to Codify Bruen Decision into Federal Law

Reading Time: 3:8 min

Ten senators determined to enshrine the Supreme Court’s landmark Bruen decision into federal law are leading a push to codify the ruling for future generations. In a time when attacks…

View post

Controversial ATF in Line to be Supersized

Reading Time: 3:12 min

Even as the Bureau of Alcohol, Tobacco, Firearms, and Explosives (ATF) is under fire for trampling the constitutional rights of law-abiding gun owners, along comes a plan to make the…

View post

Suspect Shot By CPL Holder During Robbery Outside Detroit Liquor Store

Reading Time: 3:18 min

A criminal in Detroit thought he had chosen an easy mark. The convicted felon followed two men into a Michigan liquor store and then back outside with the apparent intent…

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>