1

I am using turn.js to make a flip book. Everything is fine, but when I try to bind an event to an element inside a page, the event isn't bound.

$(document).ready(function(e) {
   $("#Test").click(function(e) {
     alert('some text')
   });
   $("#book").turn("page",$("#book").turn("pages"));
 });
<p>
  <div id="book" >
    <div class="even">
      <div class="data">1</div>
    </div>  
    <div class="odd">
      <div class="data">2</div>
    </div>
    <div class="even">
      <div class="data"><span id="Test">3</span></div>
    </div>  
  </div>

jQuery doesn't bind any event to #Test.

Álvaro González
  • 142,137
  • 41
  • 261
  • 360
Arash
  • 3,458
  • 7
  • 32
  • 50
  • I think turn.js removes bound handler, just try by setting click handler after `.turn()` and see if that's making any difference. Or check in your console: `$._data($("#Test")[0],"events").click` If click handler is there, something worst happen – A. Wolff Jan 10 '14 at 10:24
  • working for me, check http://jsfiddle.net/pranavq212/9C2Jr/ – Pranav Singh Jan 10 '14 at 10:26
  • @PranavSingh what is working? You don't include turn.js in your jsfiddle at all – A. Wolff Jan 10 '14 at 10:27
  • Alert "some text" on clicking 3 – Pranav Singh Jan 10 '14 at 10:28
  • Ya but what happen if you include turn.js??? – A. Wolff Jan 10 '14 at 10:28
  • @A.Wolff I am unable to find any link for hosted turn.js, its source is on github but home website says it needs licence http://www.turnjs.com/get :( – Pranav Singh Jan 10 '14 at 10:43
  • @PranavSingh , You Haven't included turn.js in your sample , if you include it doesn't work , turn.js version 3 is free but version 4 is licence d , i am using version 3 – Arash Jan 10 '14 at 11:51
  • maybe this can help, the syntax for events is a bit different => http://turnjs.com/docs/Turn_Events – Mark Feb 03 '14 at 09:03

0 Answers0