2A News

Rhode Island Lawmakers Propose Yet More Firearm Restrictions

Reading Time: 1:52 min

Rhode Island’s anti-gunners pushed proposals in recent days that not only erect new and unnecessary barriers between law-abiding citizens and their Second Amendment rights, but they could also automatically convert…

View post

NRA: Canada Spending $25K for Each Confiscated Firearm

Reading Time: 1:50 min

Canada’s gun owners have only days left before the March 31 deadline to declare prohibited firearms in their possession and ask the federal government for compensation as they hand over…

View post

Florida’s School Guardian Program Expected to Extend to College Campuses

Reading Time: 2:7 min

College campuses as “soft targets” will be a thing of the past if Florida Gov. Ron DeSantis (R) signs groundbreaking new legislation that sailed through the Florida Legislature last week.…

View post

Drive to Strengthen Pennsylvania’s Preemption Law Stalls in Committee

Reading Time: 1:53 min

Even as anti-Second Amendment city leaders in Pennsylvania attempt to undermine gun rights for local citizens, state officials pushed to support the state’s existing preemption law and defend the freedom…

View post

Suspect Killed After Allegedly Breaking into Ex-Girlfriend’s Residence

Reading Time: 1:51 min

One of the reasons for the massive surge in female gun ownership in recent years is the sometimes volatile nature of breakups. While most spouses and partners are mature enough…

View post

Case Against New Jersey’s Hollow Point Ban Gains Momentum

Reading Time: 1:59 min

There are several states hostile to the Second Amendment, but New Jersey leads the way in prohibiting a popular form of ammunition. In 1978, the Garden State enacted a ban…

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>