我正在尝试为每个部分添加一个类并删除一个类,以便当用户向下滚动时标题徽标会更改。
http://bitmontrade.com/sample/papa/
我现在在jQuery下面所做的操作删除了现有的div主题固定标头类,但是我无法获得addClass()
的内容
(function() {
// Override the addClass to prevent fixed header class from being added
var addclass = jQuery.fn.addClass;
jQuery.fn.addClass = function() {
var result = addclass.apply(this, arguments);
var section1 =
jQuery('#main-header').removeClass('et-fixed-header');
return result;
}
})();
jQuery(function($) {
$(document).ready(function() {
var s = $('#marketwith');
var pos = s.position();
$(window).scroll(function() {
var windowpos = $(window).scrollTop();
var section1 = $("#markettitle").offset().top
if (windowpos >= pos.top & windowpos <= section1) {
$('#main-header').removeClass('et-fixed-header');
$('#main-header').addClass('fixed-logo-change');
} else {
$('#main-header').removeClass('et-fixed-header');
$('#main-header').addClass('fixed-logo-change1');
}
});
});
});
.fixed-logo-change #logo {
content: url(http://bitmontrade.com/sample/papa/wp-content/uploads/2019/03/logofixed.png);
}
.fixed-logo-change1 #logo {
content: url(http://bitmontrade.com/sample/papa/wp-content/uploads/2019/03/logomain.png);
}
预先感谢