2A News

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

FIND Act Would Protect Gun Industry from Anti-Second Amendment Radicals

Reading Time: 3:2 min

The forces lined up to snatch away Second Amendment freedoms have several foes that must stand united. The first is the Constitution itself, which clearly grants the right to keep…

View post

MSU Rock Becomes Flashpoint for Gun Rights Debate

Reading Time: 3:18 min

The aftermath of the Michigan State University shooting that left three dead and five critically injured further stirred the debate over gun rights. Mixed in with the predictable calls for…

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>