nanogallery2 icon indicating copy to clipboard operation
nanogallery2 copied to clipboard

Dynamic custom icon depending on backend

Open kwstasna opened this issue 5 years ago • 0 comments

Hello. first of all congrats for this awesome lib!

What I want to do is to have a different custom icon (like, dislike) depending on a php call to backend if the current user has liked the displayed image or not, respectively.

How can I achieve this? On which callback or render function should I append a callback to decide which icon should the Lightbox show?

my current implementation is the following

<div ID="ngy2p">
  <a href="example1.jpg" data-ngthumb="example1.jpg">Example1</a>
  <a href="example2.jpg" data-ngthumb="example2.jpg">Example2</a>
  <a href="example3.jpg" data-ngthumb="example3.jpg">Example3</a>
</div>


	jQuery(document).ready(function () {
  var myLightboxTool = function( customElementName, $customIcon, item ) {

    alert('Media title :' + item.title);
  }

  jQuery("#ngy2p").nanogallery2({
	locationHash:     false,
	fnImgDisplayed: test,
    thumbnailWidth: 'auto',
    thumbnailDisplayTransition: "slideUp",
    thumbnailDisplayTransitionDuration: 440,
    thumbnailDisplayInterval: 19,
            thumbnailLabel: {
          position: "overImageOnTop",
          align: "left"
        },
                thumbnailHoverEffect2: "labelAppear75",
        galleryDisplayMode: "rows",
        galleryMaxRows: 3,
        thumbnailAlignment: "center",

    viewerTools:      { topRight: 'custom1,fullscreenButton,closeButton' },
    viewerToolbar:    {
             standard:  'label, fullscreenButton, custom1'},
     viewerTools:    {
             topLeft:   'label',
             topRight:  'playPauseButton, zoomButton, fullscreenButton, closeButton' },
    icons: { viewerCustomTool1:'myScript'},
    fnImgToolbarCustClick: myLightboxTool,
    fnImgToolbarCustInit: test2
  
  });
});

Fox example I want Example1 to have the LIKE button, but Example2 to have the Dislike Button etc. Thanks a lot for your time!

kwstasna avatar Jun 14 '20 09:06 kwstasna