buttonNextCallback is not called if buttonNextHTML is null #39

Closed
jerkan opened this Issue Sep 6, 2010 · 8 comments

Projects

None yet

2 participants

@jerkan
jerkan commented Sep 6, 2010

Title says it all. The question is: ¿Is it the right behaviour?

I am configuring jcarousel like this:

$('#carousel').jcarousel({
    visible: 1,
    scroll: 1,
    initCallback: carouselInitCallback,
    buttonNextCallback: carouselNextCallback,
    buttonPrevCallback: carouselPrevCallback,
    buttonNextHTML: null,
    buttonPrevHTML: null
});

If I remove last two lines (buttonNextHTML and buttonPrevHTML) callbacks are called.

I'd like buttonNextCallback and buttonPrevCallback to be called with my custom buttons. Is that possible?

@jsor
Owner
jsor commented Sep 6, 2010

See this example for how to use custom controls: http://sorgalla.com/projects/jcarousel/examples/static_controls.html

@jerkan
jerkan commented Sep 6, 2010

I modified that example like this:
[...]

function mycarousel_nextCallback(carousel, button, enabled){
console.info('next should be enabled? ' + enabled);
};

function mycarousel_prevCallback(carousel, button, enabled){
console.info('previous should be enabled? ' + enabled);
};

jQuery(document).ready(function() {
jQuery("#mycarousel").jcarousel({
scroll: 1,
initCallback: mycarousel_initCallback,
// This tells jCarousel NOT to autobuild prev/next buttons
buttonNextHTML: null,
buttonPrevHTML: null,
buttonNextCallback: mycarousel_nextCallback,
buttonPrevCallback: mycarousel_prevCallback
});
});
[...]
Check that out and see that neither mycarousel_nextCallback nor mycarousel_prevCallback are called. Then, comment 'buttonNextHTML: null', and 'buttonPrevHTML: null' and see that callbacks are called.

@jsor
Owner
jsor commented Sep 6, 2010

Ah, sorry. I misunderstood your question. Callbacks are only called on buttons created by jCarousel. External buttons are not notified. I'll put that on my todo list...

@jerkan
jerkan commented Sep 6, 2010

Thanks! :-)

@jerkan
jerkan commented Sep 7, 2010

Can you give me a clue about what should I change?

I've tried changing lines 766 and 770 like this:
if (this.options.buttonNextCallback != null) {
and
if (this.options.buttonPrevCallback != null) {
with no luck.

I really need this. Thanks in advance

@jsor
Owner
jsor commented Sep 7, 2010

Fire button callbacks also if no buttons are specified (Closed by f10693d)

@jsor
Owner
jsor commented Sep 7, 2010

Could you please try the latest development version: http://github.com/jsor/jcarousel/blob/0.2/lib/jquery.jcarousel.min.js

Callbacks should now be called also if no buttons are specified.

@jerkan
jerkan commented Sep 7, 2010

Thank you very much!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment