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

Safari 5 and Chromium 7 never start the slide show #60

Closed
fearphage opened this issue Oct 7, 2010 · 4 comments
Closed

Safari 5 and Chromium 7 never start the slide show #60

fearphage opened this issue Oct 7, 2010 · 4 comments

Comments

@fearphage
Copy link

version 0.2.4

I've tracked it down to the following lines:
http://github.com/jsor/jcarousel/blob/0.2.4/lib/jquery.jcarousel.js#L199-203

I've resolved the issue by removing the if-clause (browser sniffing):

/*if ($.browser.safari) {
  this.buttons(false, false);
  $(window).bind('load.jcarousel', function() { self.setup(); });
} else */
  this.setup();

I'm wondering why it was there in the first place and which browsers does/did it affect.

Details:

I'm loading the carousel script async after the load event and initializing it like so:

$('.slider-content ul').jcarousel({
  auto: 5,
  wrap: 'last',
  scroll: 1,
  visible: 1,
  initCallback: function(carousel) {
    $('.slider-nav ul li a').bind('click', function() {
      carousel.scroll($.jcarousel.intval($(this).text()));
      return false;
    });
  },
  buttonNextHTML: null,
  buttonPrevHTML: null,
  itemFirstInCallback: function(carousel, item, idx, state) {
    $('.slider-nav ul li a').removeClass('active').eq(idx-1).addClass('active');
  }
});

Before my fix, initCallback was called but never itemFirstInCallback.

@jsor
Copy link
Owner

jsor commented Oct 7, 2010

I'm loading the carousel script async after the load event

Could specify that a bit more. How do you exactly load jquery.jcarousel.js? I guess thats whats causing it.

@fearphage
Copy link
Author

$.getScript and the callback is the init code above.

@jsor
Copy link
Owner

jsor commented Oct 8, 2010

The problem here is that you load the jCarousel script with $.getScript, so the internal handler for $(window).load(..) is never triggered.

The reason for the browser sniffing is, that i was never able to initalize jCarousel correctly in Safari before window is loaded.

I've added a patch to the current development branch where you can call the static function $.jcarousel.windowLoaded() to set the state manually.

So, initialization goes like this:

$.getScript('..', function() {
    $.jcarousel.windowLoaded();
    $(selector).jcarousel();
});

@jsor
Copy link
Owner

jsor commented Oct 8, 2010

Add static method to set windowLoaded to true manually (Closed by 8fd7f5f)

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