Page 1 of 1

onclick not triggering

Posted: 19 April 2013, 04:08
by garcia1968
I'm modifying the reversi tutorial with my own play pieces, but it seems that once my piece(token) is temporarily placed on the board, I can no longer click on the squares underneath which it covers to register the below type event.

Code: Select all

dojo.query( '.square' ).connect( 'onclick', this, 'onPlayDisc' ); 
 
Should I client-side auto-refresh my click 'detection' squares whenever a game token is temporarily placed on top so they are back on top? Or something else easier I'm missing with how the squares are defined/click-detected?

Thanks

Re: onclick not triggering

Posted: 19 April 2013, 12:21
by Een
Hi,

Your tokens are set after the squares, so they come above them, intercept the onclick event, and transmit it to their parent (the board div).

If your token was attached to some square instead of the board, when you click on the token it would transmit the onclick event to its parent square. But in your case that's not what you want since your tokens cover multiple squares.

So I think you need to put the tokens before the squares in your .tpl (so they will be _below_ the squares when the page is built), and make your squares transparent. Then your layer for the onclick event will always be on top.

Een