开发者

Why is that Jquery not working in chrome?

开发者 https://www.devze.com 2023-01-15 23:02 出处:网络
I have this site that i am working 开发者_高级运维with. On the main page the slider rotates every 5 seconds and I have a surrounding div around the video and when clicked I fire this

I have this site that i am working 开发者_高级运维with. On the main page the slider rotates every 5 seconds and I have a surrounding div around the video and when clicked I fire this

$('.video_button_a').click(function(event){
  event.preventDefault();
  $('#slideshow').cycle('stop');
});

The second command stops the slideshow from happening and firefox it works great but chrome the slideshow keeps going..

If you open up firebug in chrome and run this then it stops

$('#slideshow').cycle('stop'); 

Any ideas on how to address this


The embedded video player in your slides are preventing the 'click' event from firing on your video_button_a. Specifically the video player is pushing the anchor to the bottom of the video. If you hover over slightly past the bottom of the video you can see your cursor change to a pointer. Your solution will depend on finding the appropriate trigger for the 'click' event. This maybe a possible solution.

As a side note, the click handler doesn't fire in firefox either when you click the play button to start the video. It seems that both firefox and chrome have the same issue.


I had similar problems with the slider not initializing properly in Chrome. Sometimes the zipper object would become available, but it never called init. I never figured out the root cause, but I successfully treated the symptoms using this ugly, ugly paraphrased code here.

$(".zipper-items").jcarousel({
  initCallback: zipperInitCallback,
  itemLoadCallback: zipperItemLoadCallback
});
window.setTimeout(loadZipperItemsBackup, 100);

function zipperInitCallback(carousel) {
  zipperCarousel = carousel;
}

function zipperItemLoadCallback(carousel, state) {
  if ('init' == state) {
    initiallyLoaded = true;
  }
}

var initiallyLoaded = false;
function loadZipperItemsBackup() {
  /* Go to page 2 of the zipper, reload the page. Chrome usually doesn't fire
   * the init, and even when it does it takes too long to happen. */
  if (!initiallyLoaded) {
    if (zipperCarousel) {
      zipperCarousel.reset();
    } else {
      window.setTimeout(loadZipperItemsBackup, 100);
    }
  }
}

Edit

In other words, it's possible that in Chrome the slideshow isn't initializing properly so the "cycle" function isn't available. Can you try $('#slideshow').reset(); and then $('#slideshow').cycle('stop');? If that does the trick then I'm in the right ballpark.

0

精彩评论

暂无评论...
验证码 换一张
取 消