2A News

Apartment Resident Shoots 22-Year-Old Allegedly Impersonating a Police Officer

Reading Time: 1:56 min

Imagine the fear and uncertainty when confronted by a police officer—only to realize that the person representing law enforcement is actually a violent criminal seeking entry to your home. Now…

View post

Semi-Automatic Firearm Ban Shot Down in Minnesota

Reading Time: 1:53 min

The all-out sprint to enact as many gun restrictions as possible for Minnesota residents hit a speed bump this week. The darling of anti-Second Amendment state lawmakers, HF 3434, is…

View post

Grand Rapids Mayor Declares Gun Owners ‘Should Be Ashamed’

Reading Time: 1:59 min

Gun control radicals don’t even bother with a pretense of moderation anymore. Instead, they trot out their anti-Second Amendment policies as if they will somehow magically transform violent criminals into…

View post

Gun Rights Opponents Throw Fit Over New Mexico Gun Control Defeat

Reading Time: 3:33 min

No matter where you stand on any prominent issue, there are likely to be victories to celebrate and defeats to ponder. But for something as clear-cut as the Second Amendment’s…

View post

NSSF Petitions SCOTUS in Lawsuit vs. NY Gun Control Regime

Reading Time: 1:58 min

New York State’s temper tantrum over its inability to destroy the weapons industry is in the crosshairs of the National Shooting Sports Foundation’s (NSSF) current lawsuit before the U.S. Supreme…

View post

West Virginia Lawmakers Propose State Machine Gun Sales to Public

Reading Time: 2:1 min

Second Amendment advocates in West Virginia are moving to restore the right to lawfully own a machine gun, and supporters base this push on established federal law. Despite the 1986…

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>