0

I have implemented on a website a picture gallery that does not allow (it seems) the auto sliding. So at the moment I have to push on a button to see the next picture. My purpose is to catch the function that allows to move to the next picture and to set a timeout to go to the next picture automatically.

How can I get the JS function name using Google Chrome developer tools?

Thank you

UPDATE

This is the Gallery script: http://tympanus.net/Development/ScatteredPolaroidsGallery/ I would like to implement auto sliding on it

qwerty
  • 227
  • 1
  • 2
  • 10

3 Answers3

1

source for code proposal from: https://github.com/codrops/ScatteredPolaroidsGallery/issues/4

(function() {
    function autoSliding(timeout) {
        var self = this;
        clearTimeout(self.timeOut);
        self.timeOut = setTimeout(function() {
            self._navigate('next');
        }, timeout);
    }

    new Photostack( document.getElementById( 'photostack-1' ), {
        afterShowPhoto: function(context) {
            autoSliding.call(context, 3000)
        },
        afterNavigate: function(context) {
            autoSliding.call(context, 3000)
        }
    });

    new Photostack( document.getElementById( 'photostack-2' ), {
        afterShowPhoto: function(context) {
            autoSliding.call(context, 3000)
        },
        afterNavigate: function(context) {
            autoSliding.call(context, 3000)
        }
    });
}())
Krzysztof Safjanowski
  • 7,292
  • 3
  • 35
  • 47
0

This should do the work

$('.navigate-next').click();

Or for auto scroll

setInterval(function(){$('.navigate-next').click();},1000);

Change 1000 for whatever you wish

Moti Korets
  • 3,738
  • 2
  • 26
  • 35
-1

If you are allowed to use jquery in your code, then, you can use $._data() method.

syntax is $._data($("selector of the element")[0], "events")

This will return an Object of all events bounded to that element. Then get the click event and call the handler attribute of the click event.

Bharath
  • 519
  • 4
  • 7
  • No, this'll only return the events that _were bound with jQuery_. If the slider used some other API then `$._data()` will be useless. – Alnitak Jun 24 '14 at 08:57
  • Yes if they use other libraries this will be useless, thats why i mentioned that "if you are allowed to use jquery in your code" – Bharath Jun 24 '14 at 09:00
  • If he can use jQuery he'd be far better off with `$('#button').trigger('click')` than futzing about with the internals of jQuery's list of bound event handlers, and the above `.trigger` call would work even if the slider used some other API. – Alnitak Jun 24 '14 at 09:04