2A News

SAF Asks if Offensive Views Should Negate Gun Rights in NJ

Reading Time: 2:16 min

It is said that no matter what issue you are passionate about, there are people on your side who you wish were not. Gun rights are no exception, and the…

View post

Missouri AG Sues ATF Over Lingering NFA Registration Requirements

Reading Time: 1:56 min

After last month’s ruling by a district judge that the old NFA registration requirements for suppressors were unconstitutional, shooting enthusiasts still await guidance from the Bureau of Alcohol, Tobacco, Firearms…

View post

NSSF Challenge to NJ’s ‘Reasonable Controls’ Law to Proceed

Reading Time: 2:10 min

The Third Circuit of the U.S. Court of Appeals on Tuesday determined that a powerful challenge to New Jersey’s gun control regime may continue. The state must now defend its…

View post

DOJ Files SCOTUS Brief in Pending Semi-Automatic Rifle Case

Reading Time: 2:14 min

A deluge of legal opinions is flying into the U.S. Supreme Court ahead of its consideration of state and local bans on AR-15s and similar weapons. All sides are weighing…

View post

Survey: Soft-on-Crime Policies to Blame for Deadly Violence

Reading Time: 1:55 min

Despite widely reported double-digit decreases in homicides and other violent crimes, the needed relief is hardly spread evenly. Strong pockets of resistance to progress remain, including two notable examples just…

View post

Oral Arguments Over AR-15 Bans Set for December

Reading Time: 2:2 min

With a landmark challenge to state and local bans on AR-15s and other sporting rifles on the U.S. Supreme Court docket, anticipation is high for a resolution on this volatile…

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>