2A News

Police: Houston Senior Citizen Shot Alleged Intruder

Reading Time: 1:54 min

Violence targeting the most vulnerable in the population, including children and older folks, is particularly heinous. But for one Texas man Wednesday afternoon who authorities described as “elderly,” being defenseless…

View post

NH School Officials Admit Student Vehicle Search Unconstitutional

Reading Time: 2:16 min

Justice is a step closer today, and the Second Amendment Foundation’s (SAF’s) legal battle against Hillsboro-Deering High School officials has been won. The New Hampshire school district admitted that its…

View post

Ruling Against Egregious Hawaii Gun Regulations Overturned

Reading Time: 2:7 min

The U.S. Supreme Court handed Hawaii’s gun owners a major victory in June when it struck down the state’s notorious “vampire rule,” but that win is diminished by an en…

View post

Glock, NSSF Sue Connecticut Over Looming Handgun Ban

Reading Time: 2:7 min

Come October 1, semi-automatic pistols with a cruciform trigger bar will be illegal in Connecticut due to third-party use of already prohibited “Glock switches” to convert the handguns to fully…

View post

SAF Challenges California’s Gun Barrel Background Check Scheme

Reading Time: 2:2 min

California officials are hellbent on nullifying the Second Amendment, and anything gun-related they cannot outright ban, they are more than happy to throw arbitrary obstacles in the way of. Take…

View post

Miami Resident Fatally Shoots Suspected Intruder

Reading Time: 2:9 min

A Florida neighborhood is on edge after the fatal shooting of a man “believed to be an intruder” early Monday. Miami Police Spokeswoman Kenia Fallat said an armed resident shot…

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>