Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buttonNextCallback is not called if buttonNextHTML is null #39

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

buttonNextCallback is not called if buttonNextHTML is null #39

jerkan opened this issue Sep 6, 2010 · 8 comments

Comments

@jerkan
Copy link

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
Copy link
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
Copy link
Author

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
Copy link
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
Copy link
Author

jerkan commented Sep 6, 2010

Thanks! :-)

@jerkan
Copy link
Author

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
Copy link
Owner

jsor commented Sep 7, 2010

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

@jsor
Copy link
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
Copy link
Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants