Sign in with
Sign up | Sign in
Your question

JQuery click function

Last response: in Applications
Share
November 27, 2012 1:29:56 PM

Hi people, can you tell me what I'm doing wrong here? The following is opening in a Fancybox iframe lightbox:

  1. <html>
  2. <head>
  3. <script type="text/javascript" src="<a href="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" rel="nofollow" target="_blank">http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquer...</a>"></script>
  4. <script type="text/javascript">
  5. $('#gallery-back-button').click(function(){
  6. $(this).fancybox.prev();
  7. });
  8. $('#gallery-next-button').click(function(){
  9. $(this).fancybox.next();
  10. });
  11. </script>
  12. <style>
  13. ...
  14. .button {
  15. display:block;
  16. position:relative;
  17. float:left;
  18. height:36px;
  19. background-repeat:no-repeat;
  20. background-position:top;
  21. text-indent:-9999px;
  22. }
  23. .button:hover {
  24. background-position:0px -36px;
  25. }
  26. .back-button {
  27. margin:0px 335px 0px 10px;
  28. width:210px;
  29. background-image:url(../../../images/buttons/back.png);
  30. text-indent:-9999px;
  31. }
  32. .next-button {
  33. width:210px;
  34. background-image:url(../../../images/buttons/next.png);
  35. text-indent:-9999px;
  36. }
  37. </style>
  38. </head>
  39. <body>
  40. ...
  41. <div id="buttons">
  42. <a href="#" id="gallery-back-button" class="button back-button">back</a>
  43. <a href="#" id="gallery-next-button" class="button next-button">next</a>
  44. </div>
  45. ...
  46. </body>
  47. </html>


When clicked, buttons do nothing.

More about : jquery click function

November 27, 2012 1:41:45 PM

OK it was just a peculiarity of Fancybox - you have to set href="javascript:p arent.$.fancybox.prev();" on the actual link.
m
0
l
!