2A News

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

LA Sheriff’s Department Rips DOJ For Pending Investigation into Gun Carry Permit Applications

Reading Time: 1:53 min

Under California’s gun control regime, Second Amendment enthusiasts meet official resistance at every turn. State residents are forced to plead with the government for a concealed carry weapons (CCW) permit,…

View post

SCOTUS Takes Case Challenging Hawaii’s ‘Vampire Rule’

Reading Time: 1:58 min

The U.S. Supreme Court will wade into Second Amendment waters again after granting certiorari in Wolford v. Lopez on Friday. This edition of the high court generally favored gun rights…

View post

Federal Judge Rules in Favor of Carry Ban on Public Land

Reading Time: 1:59 min

A federal judge on Tuesday struck a blow against gun rights for outdoor enthusiasts in what can only be described as a shocking ruling against constitutional liberties. U.S. District Judge…

View post

DOJ Sues Los Angeles County Over ‘Unreasonable Delays’ for Concealed Carry Permits

Reading Time: 1:51 min

States and municipalities are not free to run roughshod over the Second Amendment, no matter how much anti-gun politicians want to strip these rights away. Now, a powerful stand by…

View post

Federal Judge Blocks Sections of ATF’s ‘Engaged in the Business’ Rule

Reading Time: 2:2 min

American gun owners scored a significant victory in federal court on Tuesday in the fight against the Bureau of Alcohol, Tobacco, Firearms, and Explosives’ (ATF) controversial “engaged in the business…

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>