TeKilla
Posts: 14
Joined: Wed Jan 06, 2010 12:02 pm
Location: Braunschweig

remove buttons and rewrite functions for buttons

Hello again,

it's been a while since I last used Highslide (5 years), but I remembered it and want to use it again in my new project.
Everything is working fine at the moment, but here are two things i can't figure out:

1. How do you remove buttons? I didn't find anything with the search function in this forum - sorry.
I use the highslide-with-gallery.js. What I don't need are the pause, next, previous and expand to actual size buttons. I can't figure out how to remove them, where ever I do that in the js code highslide will stop working correctly.

2. Where are the functions that are called when someone presses a button? In my project, I want the user to be able to choose an image via the "play" button for further usage, this means i want to rewrite that part of the code with my own code.

Thank you in advance for the good support for this awesome tool.

Tobias
MisterNeutron
Posts: 440
Joined: Sun Aug 18, 2013 11:20 am

Re: remove buttons and rewrite functions for buttons

I'm not sure I quite understand the use-case here. I gather what you want is to use Highslide JS just to open a single thumbnail, yielding a single enlarged image, right? If you've got an actual gallery, people still need a way to navigate through it. If so, just don't use the addSlideshow() function at all. See this barebones example: http://highslide.com/examples/white-10px.html.

Rather than trying to hijack one of the existing buttons, I think you'd be better off creating your own custom overlay or, even easier, just plant your button code in the caption.

(BTW, don't bother with all of the various subsets of the script. Spare yourself a lot of head-scratching later, and just use either highslide-full.js, or highslide-full.min.js, which is just a compressed version of the same thing.)
TeKilla
Posts: 14
Joined: Wed Jan 06, 2010 12:02 pm
Location: Braunschweig

Re: remove buttons and rewrite functions for buttons

Thanks for the fast answer.
I created a little test page to get things clear:
~removed~
Right now, when the user clicks the close button, the image below the upload buttons will change to the image that was closed.
I want to use the play button for this, because closing images is an option I want the user to have :wink:

Edit: i'm trying to add a new button now, so the page looks different.
Last edited by TeKilla on Tue Feb 03, 2015 9:55 pm, edited 1 time in total.
TeKilla
Posts: 14
Joined: Wed Jan 06, 2010 12:02 pm
Location: Braunschweig

Re: remove buttons and rewrite functions for buttons

I think just adding a new button is a good idea. But now I can't figure out how to get the path of the image that has been opened, because obviously the code

Code: Select all

var exp = hs.getExpander(el);
myFunction(exp.content.src);  
is not working because I don't have the "el" object that is given to the hs.getExpander function.
MisterNeutron
Posts: 440
Joined: Sun Aug 18, 2013 11:20 am

Re: remove buttons and rewrite functions for buttons

I'll have to leave that one to RoadRash - I'm not really a Javascript guy.
TeKilla
Posts: 14
Joined: Wed Jan 06, 2010 12:02 pm
Location: Braunschweig

Re: remove buttons and rewrite functions for buttons

Ok, thanks for trying :-)
Just to clear things more up a bit:
i created a new button with the help from the faq: "How do I add a button to the gallery controls?"

in:

Code: Select all

hs.skin.controls = '<div class="highslide-controls"><ul>'+
(...)
// Start new button code
   '<li class="accept">'+
      '<a href="#" title="Accept" onclick="myFunction(imagePath)">'+
      '<span>Accept</span></a>'+
   '</li>'+
   // End new button code
(...)
How to call myFunction(String imagePath) which receives the path to the image on which the user clicked my new accept button?

This is working for the close function:

Code: Select all

close : function(el) {
   hide();
   var exp = hs.getExpander(el);
   set_image_path(exp.content.src);   
   if (exp) exp.close();
   return false;
}
But here the close function receives the parameter "el", and i don't have any idea where i can get it.
User avatar
RoadRash
Posts: 8249
Joined: Tue Jul 15, 2008 6:43 pm
Location: Fredrikstad, Norway
Contact: Website

Re: remove buttons and rewrite functions for buttons

Adding the controlbar, remove all buttons but the close button and then add a custom button, is a messy way to achieve what you want. The easiest is to add a Close button + a custom button in the caption or heading overlay.
Please see this demo with buttons in the heading overlay: http://jsfiddle.net/roadrash/hhn88ves/
Hilde
Highslide Support Team

Overview of my Highslide sample pages: RoadRash.no

Return to “Highslide JS Usage”