2A News

Maryland’s Version of ‘Vampire Rule’ Struck Down by Appeals Court

Reading Time: 1:54 min

Even as Hawaii’s contentious “vampire rule” is before the U.S. Supreme Court, a lower court last week struck a blow against Maryland’s similar law. The Fourth Circuit Court of Appeals…

View post

Florida Gun Dealer Extradited to New York to Face Charges

Reading Time: 1:59 min

A Florida man targeted by New York officials for selling gun kits and parts is now at the notorious Riker’s Island prison facility after being flown from the Orange County…

View post

SCOTUS Startled by Reliance on Racist Laws to Defend ‘Vampire Rule’

Reading Time: 3:33 min

It’s said that the secret to seeing everything is simply living long enough. If that’s true, the U.S. Supreme Court listened to the claims of a lifetime this week as…

View post

Lynchburg Leaders Push for Second Amendment Sanctuary Status

Reading Time: 2:7 min

When a storm is coming, smart people prepare. They know to have fresh water, flashlights, generators, and other essential items for what lies ahead. The same holds for protecting our…

View post

Arizona Man Fatally Shoots Alleged Intruder

Reading Time: 1:58 min

Word will spread at some point that it is unwise to break into another person’s home in the U.S. With hundreds of millions of firearms in law-abiding citizens’ hands and…

View post

Security Guard Cleared in Fatal Self-Defense Shooting of Armed Woman

Reading Time: 1:53 min

A Michigan security guard is in the clear after a shooting claimed the life of a young woman. According to Southfield Police Chief Elvin Barren, 33-year-old Alexandra Fields was involved…

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>