We have an animated Radio button, and we want to maintain the clicked (animated) state after the user clicks on the radio to set their state.
To be exact: we enable Live chat between members and people visiting their Web site, and we have a Radio button that is animated in its state, so that when they click on “I am not available for call” the radio slides to indicate this new state for them. And vis versa.
So my question is how do we save/set the CSS class :after value?
Further FYI: after user clicks the Radio to indicate what state they want to be, this state is transmitted to server via AJAX and set in DB via Php.
So of course we can set the values of the related CSS code either via Php if done server side and then loaded OR we can set it via JavaScript. 1st, Which one of these 2 methods is your code working with and 2nd where is the variable code to do or JS call to affect?
I must have misunderstood the question as I thought you were asking how to style a radio button when it is checked. You don’t need js for that you style the checked state as required.
Obviously saving the state to the back end is a programming issue and beyond the scope of html/css.
If members need to log in to see relevant code to assist you with your issue, then I suggest you set up a test account we can use, and post the log-in details here, or make it available by PM on request. Many members will, quite rightly, be reluctant to sign up for an account simply to help resolve an issue.
Yes, I was hoping someone could provide the answer to this question based on all the CSS that I provided above in the body of the question. So my question is rather simple but of course not either, and again it is: HOW do we have a CSS in its after state rather than the before state? which is its default state as someone loads the page.
So basically once someone has clicked on the Radio (animated) button, how do we then either in CSS or via JS set their selected after State which would be:
After much fussing with this CSS based animation we decided not to spend any more time on this and instead go with JS based animation which then of course means we have all knowledge of the states.