Jump to content

Class IDs list?

Recommended Posts

48 minutes ago, Blackbearsfire said:

Is there a list of class IDs to target different types of images with custom css?

You can use the following extension to get page id, section id, block id: Squarespace ID Finder

 

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
On 11/3/2022 at 9:38 AM, Blackbearsfire said:

Is there a list of class IDs to target different types of images with custom css?

To target Image in Image Blocks, Gallery Block, Summary Block, you can use Block ID

To target Section Background Image, List Section Image, Gallery Section Image, you can use data-section-id

You can use this tool to find block id, data section id.

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 1 year later...

What if I want to target all images? I want to show Alt text on mouse hover on all images, and if there is no Alt text just CompanyName, is it possible?

Got this script, but not sure what to correct:

<script>
document.addEventListener('DOMContentLoaded', function() {
  const images = document.querySelectorAll('img');
  images.forEach(img => {
    const altText = img.getAttribute('alt') || 'Decoflame';
    img.setAttribute('title', altText);

    // Optional: Custom tooltip for hover
    img.addEventListener('mouseover', function() {
      const tooltip = document.createElement('div');
      tooltip.textContent = altText;
      tooltip.style.position = 'absolute';
      tooltip.style.background = 'white';
      tooltip.style.border = '1px solid black';
      tooltip.style.padding = '5px';
      document.body.appendChild(tooltip);

      img.addEventListener('mousemove', function(e) {
        tooltip.style.top = e.pageY + 10 + 'px';
        tooltip.style.left = e.pageX + 10 + 'px';
      });

      img.addEventListener('mouseout', function() {
        document.body.removeChild(tooltip);
      });
    });
  });
});
</script>

 

Link to comment
On 5/16/2024 at 6:21 PM, Ikko-ikki said:

What if I want to target all images? I want to show Alt text on mouse hover on all images, and if there is no Alt text just CompanyName, is it possible?

Got this script, but not sure what to correct:

<script>
document.addEventListener('DOMContentLoaded', function() {
  const images = document.querySelectorAll('img');
  images.forEach(img => {
    const altText = img.getAttribute('alt') || 'Decoflame';
    img.setAttribute('title', altText);

    // Optional: Custom tooltip for hover
    img.addEventListener('mouseover', function() {
      const tooltip = document.createElement('div');
      tooltip.textContent = altText;
      tooltip.style.position = 'absolute';
      tooltip.style.background = 'white';
      tooltip.style.border = '1px solid black';
      tooltip.style.padding = '5px';
      document.body.appendChild(tooltip);

      img.addEventListener('mousemove', function(e) {
        tooltip.style.top = e.pageY + 10 + 'px';
        tooltip.style.left = e.pageX + 10 + 'px';
      });

      img.addEventListener('mouseout', function() {
        document.body.removeChild(tooltip);
      });
    });
  });
});
</script>

 

All Image has ID

img

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.