2A News

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

Repeal of State Handgun Permit Requirement Goes to NC Governor’s Desk

Reading Time: 3:7 min

In a victory for Second Amendment advocates, a bill to repeal North Carolina’s handgun permit requirement cleared the state House and is headed to the governor’s desk by a nearly…

View post

West Virginia Legislature Overwhelmingly Approves Campus Carry Measure

Reading Time: 2:59 min

West Virginia is set to become the latest state to allow campus carry after the House of Delegates passed the legislation in a landslide 84-13 vote. This followed the Senate…

View post

Police Praise Armed Georgia Man Who Stopped Stabbing Spree

Reading Time: 3:2 min

A Georgia man was awakened early Saturday morning in just about the worst way possible. Josh Dobbs was undoubtedly startled to hear the sound of a woman screaming for help…

View post

Legally Armed Civilian Wounds Suspect in Fatal El Paso Mall Shooting

Reading Time: 2:58 min

A legally armed good guy stepped up Wednesday and stopped the suspect in a fatal shooting at a shopping mall in El Paso, Texas, that killed one and injured three…

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>