How to use div as a link for internal pages?
Hello everybody!
I'm new, so please excuse me if this question was already asked. I would like to use jquery-mobile schema for internal pages accessible via anchor links, but I would like to make my entire div clickable (containing an image, some text - something like a mobile news site). My div data-role=page consists of several smaller css styled divs containing mobile news clips, and these divs need to be clickable anywhere.
What I've tried so far:
If I use ordinary 'a' links with href to anchor, everything works as expected, but I need the entire div clickable. Window.location.hash depending on changehash event did the trick, but no history, so that's out. onClick="javascript:$.mobile.changePage()" method also had issues with history (back button doesn't work) and it's also quite slow because click method waits a while iirc.
What I'd like to do:
I'd like to assign something like a tap event to the entire div to trigger a single common function that would read for example a custom attribute assigned to this div by a django template and trigger the usual method for following internal page links. Help?
Any advice would be kindly appreciated.
Thanks in advance.