0
I need to assign the following function to a Vue.js. component.: https://easymei.com.br/ja-sou-mei/
$(window).load(function() {
function fixedSection() {
var imageW = $(".fixed-contents").find(".images .img").height()/2;
$(".fixed-contents").find(".images .img").css("margin-top", -imageW);
var ativar = $(".fixed-contents").offset().top;
var fxH = $(".fixed-contents").height();
var wH = $(window).height();
var travar = $('.after-fixed-section').offset().top - wH;
var section1 = $('#section1').offset().top;
var section2 = $('#section2').offset().top;
var section3 = $('#section3').offset().top;
var section4 = $('#section4').offset().top;
var section5 = $('#section5').offset().top;
var section6 = $('#section6').offset().top;
var section7 = $('#section7').offset().top;
var scrollOffset = 100;
var scroll = $(window).scrollTop() + scrollOffset;
if ( scroll - scrollOffset < ativar - 1 ) {
$(".fixed-contents").find(".images").removeClass("fixed");
$(".fixed-contents").find(".images .bg").css("display", "none");
$(".fixed-contents").find(".images .bg1").css("display", "block");
} else {
$(".fixed-contents").find(".images").addClass("fixed");
}
if ( scroll < section2 ) {
$(".fixed-contents .item").removeClass("active");
$("#section1").addClass("active");
$(".fixed-contents").find(".images .bg").css("display", "none");
$(".fixed-contents").find(".images .bg1").css("display", "block");
}
if ( scroll > section1 ) {
$(".fixed-contents .item").removeClass("active");
$("#section2").addClass("active");
$(".fixed-contents").find(".images .bg").css("display", "none");
$(".fixed-contents").find(".images .bg2").css("display", "block");
}
if ( scroll > section2 ) {
$(".fixed-contents .item").removeClass("active");
$("#section3").addClass("active");
$(".fixed-contents").find(".images .bg").css("display", "none");
$(".fixed-contents").find(".images .bg3").css("display", "block");
}
if ( scroll > section3 ) {
$(".fixed-contents .item").removeClass("active");
$("#section4").addClass("active");
$(".fixed-contents").find(".images .bg").css("display", "none");
$(".fixed-contents").find(".images .bg4").css("display", "block");
}
if ( scroll > section4 ) {
$(".fixed-contents .item").removeClass("active");
$("#section5").addClass("active");
$(".fixed-contents").find(".images .bg").css("display", "none");
$(".fixed-contents").find(".images .bg5").css("display", "block");
}
if ( scroll > section5 ) {
$(".fixed-contents .item").removeClass("active");
$("#section6").addClass("active");
$(".fixed-contents").find(".images .bg").css("display", "none");
$(".fixed-contents").find(".images .bg6").css("display", "block");
}
if ( scroll > section6 ) {
$(".fixed-contents .item").removeClass("active");
$("#section7").addClass("active");
$(".fixed-contents").find(".images .bg").css("display", "none");
$(".fixed-contents").find(".images .bg7").css("display", "block");
}
if ( scroll - scrollOffset >= travar) {
$(".fixed-contents").find(".images").addClass("travar");
} else {
$(".fixed-contents").find(".images").removeClass("travar");
}
}
fixedSection();
$(window).scroll(function() {
var ww = $(window).width();
if(ww > 800) {
fixedSection();
} else {
$(".fixed-contents").find(".images").removeClass("fixed");
}
});
$(window).resize(function() {
var ww = $(window).width();
if(ww > 800) {
fixedSection();
} else {
$(".fixed-contents").find(".images").removeClass("fixed");
}
});
});
the way it is in this code has to be passed in the concept of components in Vuejs, it is not complicated, but, I think no one will do for you, unfortunately we here can not do it.
– novic