[wp-trac] [WordPress Trac] #34130: Thickbox previous arrow

WordPress Trac noreply at wordpress.org
Fri Oct 2 15:22:53 UTC 2015


#34130: Thickbox previous arrow
--------------------------+-----------------------------
 Reporter:  Eric3D        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Gallery       |    Version:  4.3.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 The previous arrow in Thickbox does not work reliably. It sometimes
 displays 2 images, sometimes displays just the caption.

 Since that problem does not happen with the buttons, I suggest using the
 "trigger" function instead. The following code seems to work more reliably
 (staring at line 137):
 {{{
 function goPrev(){
 if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
         jQuery("#TB_window").remove();
         jQuery("body").append("<div id='TB_window'></div>");
         tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
         return false;
 }
 jQuery("#TB_prev").click(goPrev);

 function goNext(){
         jQuery("#TB_window").remove();
         jQuery("body").append("<div id='TB_window'></div>");
         tb_show(TB_NextCaption, TB_NextURL, imageGroup);
         return false;
 }
 jQuery("#TB_next").click(goNext);

 jQuery(document).bind('keydown.thickbox', function(e){
         if ( e.which == 27 ){ // close
                 tb_remove();
         } else if ( (e.which == 190) || (e.which == 39) ){ // display next
 image
                 jQuery("#TB_next").trigger( "click" );
         } else if ( (e.which == 188) || (e.which == 37) ){ // display
 previous image
                 jQuery("#TB_prev").trigger( "click" );
         }
         return false;
 });
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34130>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list