Welcome, Guest
Username: Password: Remember me

TOPIC: Recreating accessibility options

Recreating accessibility options 1 year 5 days ago #4996

  • Neil Pollock
  • Neil Pollock's Avatar
  • Offline
  • Senior Boarder
  • Posts: 66
  • Thank you received: 3
I have a learning object where I've used a pseudo element to display a background image. This obviously breaks the colour change accessibility options (Remove Background Images, Invert, Black on Yellow).

I'm trying to figure out if it's possible to recreate these features, or to add some additional rules depending on which option has been clicked.

As a very rough proof of concept I put this together, which essentially does what I need: codepen.io/anon/pen/GxqZMV

However, I can't get this to work in an XOT object - it just doesn't seem to acknowledge any of the clicks to the colour change options in the same way.

Am I missing something obvious here? Is it even possible to change/add to the colour change options in this way?
Last Edit: 1 year 5 days ago by Neil Pollock.
The administrator has disabled public write access.

Recreating accessibility options 1 year 5 days ago #4997

  • Fay
  • Fay's Avatar
  • Offline
  • Expert Boarder
  • Posts: 140
  • Thank you received: 43
Hi Neil

I don't know exactly how you are putting this code in your Xerte project but at a guess I think the colour changer dialog doesn't exist at that point so it can't find the elements to attach your new code to.

The dialog doesn't get created until the colour changer button is clicked for the first time so you need to link your code to this first click. Try something along these lines to set it up:
var setUp = 0; // this makes sure that the change function is only set up once, even if colour dialog is opened several times
$x_colourChangerBtn.click(function() {
  if (setUp == 0) {
    setTimeout(function(){ // this just makes sure the dialog contents is ready
      $('#colourChangerOptions input[type=radio] name=colourChangerRadios]').change(function() {
        console.log(this.value); // put your code here - value will tell you which radio button is selected
      });
    }, 0);
    setUp = 1;
  }
});
The administrator has disabled public write access.
The following user(s) said Thank You: Neil Pollock

Recreating accessibility options 1 year 5 days ago #4999

  • Neil Pollock
  • Neil Pollock's Avatar
  • Offline
  • Senior Boarder
  • Posts: 66
  • Thank you received: 3
That makes sense, and a quick test seems to work.

Thanks!
The administrator has disabled public write access.
Moderators: Alistair McNaught
Time to create page: 0.478 seconds
Powered by Kunena Forum

Donate

Sponsor us

The Xerte Community is a volunteer-based organization. Please help us to continue that!