我在使用 jquery 绑定单击事件时遇到问题。它在所有浏览器中都可以正常工作,但在 Firefox 中却不行。提前感谢您的回答。
var conf_markers = function() {
// create a wrapper for our markers
$m_wrapper = $('<ol class="bjqs-markers"></ol>');
// for every slide, create a marker
$.each($slides, function(key, slide){
var slidenum = key + 1,
gotoslide = key + 1;
if(settings.animtype === 'slide'){
// + 2 to account for clones
gotoslide = key + 2;
}
var marker = $('<li><a href="#"></a></li>');
// set the first marker to be active
if(slidenum === state.currentslide){ marker.addClass('active-marker'); }
// bind the click event
marker.bind('click','a',function(e){
e.preventDefault();
if(!state.animating && state.currentslide !== gotoslide){
go(false,gotoslide);
}
});
// add the marker to the wrapper
marker.appendTo($m_wrapper);
});
$m_wrapper.appendTo($wrapper);
$m_markers = $m_wrapper.find('li');
// center the markers
if (settings.centermarkers) {
$m_wrapper.addClass('h-centered');
var offset = (settings.width - $m_wrapper.width()) / 2;
$m_wrapper.css('left', offset);
}
};
据我所知,行 marker.bind('click','a',function(e){ 是导致此问题的原因。