fix:首页切换图片bug

This commit is contained in:
2025-05-09 11:05:21 +08:00
parent db94557c06
commit 1f33d2b9f8
6 changed files with 748 additions and 406 deletions

View File

@@ -1 +1,27 @@
!function(a){function b(b,c,d){b.on("mousedown.ba-events touchstart.ba-events",function(e){b.addClass("ba-draggable"),c.addClass("ba-resizable");var f=e.pageX?e.pageX:e.originalEvent.touches[0].pageX,g=b.outerWidth(),h=b.offset().left+g-f,i=d.offset().left,j=d.outerWidth();minLeft=i+10,maxLeft=i+j-g-10,b.parents().on("mousemove.ba-events touchmove.ba-events",function(b){var c=b.pageX?b.pageX:b.originalEvent.touches[0].pageX;leftValue=c+h-g,leftValue<minLeft?leftValue=minLeft:leftValue>maxLeft&&(leftValue=maxLeft),widthValue=100*(leftValue+g/2-i)/j+"%",a(".ba-draggable").css("left",widthValue),a(".ba-resizable").css("width",widthValue)}).on("mouseup.ba-events touchend.ba-events touchcancel.ba-events",function(){b.removeClass("ba-draggable"),c.removeClass("ba-resizable"),a(this).off(".ba-events")}),e.preventDefault()})}a.fn.beforeAfter=function(){var c=this,d=c.width()+"px";c.find(".resize img").css("width",d),b(c.find(".handle"),c.find(".resize"),c),a(window).resize(function(){var a=c.width()+"px";c.find(".resize img").css("width",a)})}}(jQuery);
! function (a) {
function b(b, c, d) {
b.on("mousedown.ba-events touchstart.ba-events", function (e) {
b.addClass("ba-draggable"), c.addClass("ba-resizable");
var f = e.pageX ? e.pageX : e.originalEvent.touches[0].pageX,
g = b.outerWidth(),
h = b.offset().left + g - f,
i = d.offset().left,
j = d.outerWidth();
minLeft = i + 10, maxLeft = i + j - g - 10, b.parents().on("mousemove.ba-events touchmove.ba-events", function (b) {
var c = b.pageX ? b.pageX : b.originalEvent.touches[0].pageX;
leftValue = c + h - g, leftValue < minLeft ? leftValue = minLeft : leftValue > maxLeft && (leftValue = maxLeft), widthValue = 100 * (leftValue + g / 2 - i) / j + "%", a(".ba-draggable").css("left", widthValue), a(".ba-resizable").css("width", widthValue)
}).on("mouseup.ba-events touchend.ba-events touchcancel.ba-events", function () {
b.removeClass("ba-draggable"), c.removeClass("ba-resizable"), a(this).off(".ba-events")
}), e.preventDefault()
})
}
a.fn.beforeAfter = function () {
var c = this,
d = c.width() + "px";
c.find(".resize img").css("width", d), b(c.find(".handle"), c.find(".resize"), c), a(window).resize(function () {
var a = c.width() + "px";
c.find(".resize img").css("width", a)
});
return this
}
}(jQuery);