Target multiple elements using a...

User 244626 Photo


Registered User
811 posts

Here is a way to target multiple elements using a common data-attribute and class named "togon" onmouseenter utilizing a jscript. (Thanks Eric and Inger !)

To edit the individual elements first apply your settings to your element(s) that has a unique class name,the class togon, and a id. Then duplicate the element, delete the togon class, and make your changes to the duplicated element. This gives you a visual on your changes. After you are finished, just delete the duplicated element. Now you have two settings stored in your original element. Preview and you will see the element settings when there is no mouse over object because togon has not been removed. When mouse enters object, togon is removed and you see your new settings. Since this is happening to any element tied to the attribute "data-tog" anything with that attribute and the element we target by id (element1id) is updated with the toggled css settings. If you need to make a quick change you can always just deselect the class togme on any of the elements that are targeted.

All elements you are targeting must have a id.
Attachments:
Bootstrap 5 CSS Grid.
User 122279 Photo


Senior Advisor
14,450 posts

I'll try them out - all of them. Bit busy right now, though.
Ha en riktig god dag!
Inger, Norway

My work in progress:
Components for Site Designer and the HTML Editor: https://mock-up.coffeecup.com


User 187934 Photo


Senior Advisor
20,188 posts

JS is awesome.:cool:
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2699991 Photo


Registered User
4,799 posts
Online Now

Twinstream wrote:
Here is a way to target multiple elements using a common data-attribute and class named "togon" onmouseenter utilizing a jscript. (Thanks Eric and Inger !)

To edit the individual elements first apply your settings to your element(s) that has a unique class name,the class togon, and a id. Then duplicate the element, delete the togon class, and make your changes to the duplicated element. This gives you a visual on your changes. After you are finished, just delete the duplicated element. Now you have two settings stored in your original element. Preview and you will see the element settings when there is no mouse over object because togon has not been removed. When mouse enters object, togon is removed and you see your new settings. Since this is happening to any element tied to the attribute "data-tog" anything with that attribute and the element we target by id (element1id) is updated with the toggled css settings. If you need to make a quick change you can always just deselect the class togme on any of the elements that are targeted.

All elements you are targeting must have a id.


Hi Twinstream
Mastering The Understanding With Hands-On Learning
NEW TO "COFFEECUP SITE DESIGNER" FOUNDATION 6 FRAMEWORK?
STUCK ON SOMETHING?

LEARNING & UNDERSTANDING "THE HOW TO"? THE WHY'S & THE WHEREFORE'S?
WITH WAYAN'S STEP BY STEP TUTORIALS
Contact Me For One To One Assistance
https://alphathemes.coffeecup.com/forms … an%281%29/

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.