2A News

Oregon Voters May Decide to Ban Hunting and Fishing

Reading Time: 1:57 min

Some radical Oregon activists want to place an initiative on this November’s ballot that would effectively prohibit hunting and fishing in the state. The People for the Elimination of Animal…

View post

Lawmakers Demand ATF Address Illegal Firearms Registry

Reading Time: 2:1 min

Federal law established in 1986 directly banned the establishment of a national gun registry, and for obvious reasons. Such a list is a giant leap toward anti-gunners’ ultimate goal—the confiscation…

View post

Report: New Mexico’s Proposed Firearm Ban is Circling the Drain

Reading Time: 1:58 min

Second Amendment advocates are on the verge of a significant victory in New Mexico, according to a report by the Santa Fe New Mexican on the skirmish over a proposed…

View post

Victory! VA Ends Reporting Veterans Who Need Financial Assistance to NICS

Reading Time: 3:29 min

Reasonable people can and will disagree on issues, and under everyday circumstances, it does not make either a bad person. But there are often protocols and practices that are virtually…

View post

2A Community Generates $1 Billion+ for Conservation Fund

Reading Time: 1:49 min

To hear some in the mainstream media tell it, the Second Amendment community is a scourge on the American cultural landscape that we would be much better off without. This…

View post

Alabama Homeowner Shoots Body Armor-Wearing Alleged Car Burglar

Reading Time: 1:53 min

An Alabama man last Wednesday was presumably experiencing a rather normal day when he was confronted by what had to be a strange and frightening sight. The Limestone County man…

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>