Blackbearsfire Posted November 3, 2022 Posted November 3, 2022 Is there a list of class IDs to target different types of images with custom css?
Beyondspace Posted November 3, 2022 Posted November 3, 2022 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 Blackbearsfire 1 BeyondSpace - Squarespace Website Developer 🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </> 🗓️ Delivery Date Picker (Date picker form field) Gallery block 7.1 workaround </> 🤖 Ask me anything
tuanphan Posted November 6, 2022 Posted November 6, 2022 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. Blackbearsfire 1 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!)
Ikko-ikki Posted May 16 Posted May 16 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>
tuanphan Posted May 18 Posted May 18 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!)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment