jquery - How to disable buttons from Button Helper for single image, and enable all this buttons for the gallery? (Fancybox 2) -


fancybox 2.

html:

<p><b><h3>gallery</h3></b></p>    <br /> <p><a class="image" rel="group" href="http://farm4.staticflickr.com/3787/9028269192_9b4ddf345d_b.jpg" title="tolpis barbata (mariluzpicado)"> <img src="http://farm4.staticflickr.com/3787/9028269192_9b4ddf345d_m.jpg" alt="" /> </a> <a class="image" rel="group" href="http://farm4.staticflickr.com/3745/8971419780_cb88b22947_b.jpg" title="(dsavin)"> <img src="http://farm4.staticflickr.com/3745/8971419780_cb88b22947_m.jpg" alt="" /> </a> <a class="image" rel="group" href="http://farm9.staticflickr.com/8522/8478415115_152c6f5e55_b.jpg" title="a ride in blue? (cembayir_photography)"> <img src="http://farm9.staticflickr.com/8522/8478415115_152c6f5e55_m.jpg" alt="" /> </a> <a class="image" rel="group" href="http://farm9.staticflickr.com/8366/8483546751_86494ae914_b.jpg" title="reedit... (h_di)"> <img src="http://farm9.staticflickr.com/8366/8483546751_86494ae914_m.jpg" alt="" /> </a></p> <br />  <p><h3><b>single image</b></h3></p> <br /> <p><a class="image" rel="single" href="http://farm4.staticflickr.com/3712/9032543579_1217e6566b_b.jpg" title="singapore air (andrew tan 2011)"> <img src="http://farm4.staticflickr.com/3712/9032543579_1217e6566b_m.jpg" alt="" />  </a></p> 

by default cyclic navigation enabled ("loop" option set in value "true") gallery, single image, , button helper buttons visible.
example

css:

$(document).ready(function() { $(".image").fancybox({     preveffect: 'none',     nexteffect: 'none',     closebtn: false,     helpers: {     title   : { type : 'inside' },     buttons : {}     } }); });   

if "loop" option set in value "false", cyclic navigation disabled gallery, single image, , single image button helper buttons not visible.
example

css:

$(document).ready(function() { $(".image").fancybox({     preveffect: 'none',     nexteffect: 'none',     closebtn: false,     loop : false,     helpers: {     title   : { type : 'inside' },     buttons : {}     } }); });  

1) how disable next, play/pause, previous buttons on button helper single image?
+
2) how enable buttons gallery, include next button last picture, , previous, play/pause buttons last image?

i trying this, nothing happens:

aftershow: function () {     if (this.group.length < 2) {     $("#fancybox-buttons").find('.btnprev').addclass('btndisabled');     $("#fancybox-buttons").find('.btnnext').addclass('btndisabled');     $("#fancybox-buttons").find('.btnplay').addclass('btndisabled');}  else if (!this.group.length > 1){     $("#fancybox-buttons").find('.btnprev').removeclass('btndisabled');     $("#fancybox-buttons").find('.btnnext').removeclass('btndisabled');     $("#fancybox-buttons").find('.btnplay').removeclass('btndisabled');} } 

forget finding elements and/or adding btndisabled classes, etc. add conditional in aftershow callback :

aftershow: function () {     if(this.group.length < 2){         // gallery has single element disable loop         $.extend(this,{             loop: false         });     }     // more options, etc.  } // end aftershow 

see jsfiddle .... or updated jsfiddle


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -