2A News

Alleged NC Robber Wanted Cash, Got Shot in the Foot Instead

Reading Time: 1:57 min

It is ill-advised to attempt to rob a business establishment that was struck by criminals recently. There is a good chance the proprietors upgraded their defense capabilities and are much…

View post

US Gun Sales Surge 2% in September After Seven Months of Decline

Reading Time: 1:49 min

Gun sales skyrocketed to new heights during the pandemic and the social unrest that accompanied it, so it is hardly surprising to see transactions level off from recent peaks. Still,…

View post

Judge Orders Chicago PD to Cease Carrying Sig Sauer P320 Handguns

Reading Time: 2:2 min

A new twist in the saga surrounding the popular Sig Sauer P320 handgun emerged this week. Despite strong denials from the company and a battery of tests, there continue to…

View post

Federal Court: Ban on Firearms in Post Offices Unconstitutional

Reading Time: 1:53 min

The cumulative effect of years of waging battles with anti-gun politicians means that there are some restrictions still on the books that need to be abolished. A step in that…

View post

Colt Canada Denies Involvement in Confiscation Scheme

Reading Time: 1:57 min

The pervasiveness of the internet in modern life means that rumors may quickly take on a life of their own and spread around the globe—even when there is no validity…

View post

Gun Rights Take Center Stage in Pennsylvania House

Reading Time: 1:60 min

Second Amendment advocates scored significant victories in their battle against yet more gun control in the Pennsylvania House, but there was also a major defeat to absorb. Representatives last week…

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>