2A News

Cornyn Unveils Legislation to Strengthen PLCAA Against Destructive Lawfare

Reading Time: 2:7 min

Over 20 years ago, a bipartisan Congress passed the Protection of Lawful Commerce in Arms Act (PLCAA) to shield the weapons industry from frivolous lawsuits intended to destroy manufacturers and…

View post

Oregon Lawmaker Blasts Initiative That Would Effectively Ban Hunting

Reading Time: 2:15 min

The Second Amendment community is a big tent, and any law-abiding American who supports constitutional rights is welcome.  That’s regardless of political affiliation as well, and honest observers note that…

View post

Texas Candidate Claims Banning Private Gun Sales is ‘Common Sense’

Reading Time: 1:58 min

It is difficult to conceive of a candidate running for statewide office in Texas and holding beliefs opposed to those who treasure the Second Amendment’s protections. First, however, Senate candidate…

View post

Anti-2A Forces Celebrate SCOTUS’s Refusal to Hear Challenge to NY Law

Reading Time: 3:42 min

The schizophrenic nature of the U.S. Supreme Court when it pertains to Second Amendment rights is front and center this week after the bench turned away a challenge to the…

View post

US Rep. Proposes Total Ban on Firearm Suppressors

Reading Time: 1:59 min

First things first. The Hollywood portrayal of suppressors as accessories that make a gunshot sound like a butterfly’s wings is simply false. And only on the big screen will you…

View post

Washington Supreme Court: 2 DUIs Erase Second Amendment Rights

Reading Time: 1:60 min

The Washington State Supreme Court on Thursday cleared the way for enforcement of a new state law targeting drunk drivers. And gun owners. To be clear, drinking and driving is…

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>