ДОбавить в реакт/ React js
5 USDНужно добавить следующий скрипт в реакт
var doc = window.document,
context = document.querySelector('.js-loop'),
clones = document.querySelectorAll('.is-clone'),
disableScroll = false,
scrollHeight = 0,
scrollPos = 0,
clonesHeight = 0,
i = 0;
function getScrollPos () {
return (context.pageYOffset || context.scrollTop) - (context.clientTop || 0);
}
function setScrollPos (pos) {
context.scrollTop = pos;
}
function getClonesHeight () {
clonesHeight = 0;
for (i = 0; i < clones.length; i += 1) {
clonesHeight = clonesHeight + clones[i].offsetHeight;
}
return clonesHeight;
}
function reCalc () {
scrollPos = getScrollPos();
scrollHeight = context.scrollHeight;
clonesHeight = getClonesHeight();
if (scrollPos <= 0) {
setScrollPos(1); // Scroll 1 pixel to allow upwards scrolling
}
}
function scrollUpdate () {
if (!disableScroll) {
scrollPos = getScrollPos();
if (clonesHeight + scrollPos >= scrollHeight) {
// Scroll to the top when you’ve reached the bottom
setScrollPos(1); // Scroll down 1 pixel to allow upwards scrolling
disableScroll = true;
} else if (scrollPos <= 0) {
// Scroll to the bottom when you reach the top
setScrollPos(scrollHeight - clonesHeight);
disableScroll = true;
}
}
if (disableScroll) {
// Disable scroll-jumping for a short time to avoid flickering
window.setTimeout(function () {
disableScroll = false;
}, 40);
}
}
function init () {
reCalc();
context.addEventListener('scroll', function () {
window.requestAnimationFrame(scrollUpdate);
}, false);
window.addEventListener('resize', function () {
window.requestAnimationFrame(reCalc);
}, false);
}
if (document.readyState !== 'loading') {
init()
} else {
doc.addEventListener('DOMContentLoaded', init, false)
}
По итогу страница должна быть в скролиться по лупу.
import { useState, useRef } from 'react';
import { Navbar } from './components';
import './index.css'
import './app.css'
import Marquee3k from 'marquee3000';
const App = () => {
return (
<div className=" p-5 overflow-hidden">
<Navbar/>
<main class="Loop js-loop">
<div className="p-5 one " id="element"> Home Page </div>
<div className="p-5 two min-h-screen bg-neutral-300" > Home Page </div>
<div className="p-5 three min-h-screen bg-neutral-400 " > Home Page </div>
<div className="p-5 four min-h-screen bg-neutral-500 " > Home Page </div>
<div className="p-5 three min-h-screen bg-neutral-600 "> Home Page </div>
<div className="p-5 one is-clone " > Home Page </div>
<div className="p-5 two is-clone min-h-screen bg-neutral-300" > Home Page </div>
</main>
</div>
)
}
export default App;
Applications 2
Client's review of cooperation with Kristina K.
ДОбавить в реакт/ React jsGood, fast and high quality work! I definitely recommend working with Christina.
Freelancer's review of cooperation with Gleb Savelev
ДОбавить в реакт/ React jsThank you for cooperation! A very pleasant customer, everything clarifies clearly and always in contact. It was very comfortable to work. We would be happy to continue our cooperation in the future!
-
639 9 0 Bread, good day, with contact, I will perform your task, I can start now
-
2311 57 0 Hello to you! Ready to take on, with the task familiar. Write, time and price indicated.
-
1407 27 1 1 Good day ! The task is easy, I will do it all right now. I will be happy to cooperate!
-
798 28 5 2 Hmmm, what is the bottom? The task is easy, I can add now, with the reaction familiar more than
-
192 34 1 1 Hello to you.
I specialize in the reaction.
Write, we will do it.
I work through the safe.
Current freelance projects in the category Web Programming
Landing page for a psychologistTask. Create a "turnkey" and "launch" landing page for a psychologist with potential for expansion (adding a menu and other pages). Sequential screenshots of the desired design are in the attached files. For this specialist https://barb.ua/uk/zaporozhye/master/izubar… Web Programming ∙ 45 minutes back ∙ 10 proposals |
Primatic - Transfer of 3 pages from Figma to WordPress (Elementor)Hello! My name is Anna, I live in Israel and run a small creative studio. I mainly work with small and medium businesses and am currently looking for a freelancer for long-term collaboration. At the moment, there is a project: we need to transfer a finished design from Figma… HTML & CSS, Web Programming ∙ 1 hour 52 minutes back ∙ 20 proposals |
Looking for a Frontend Developer (React + Tailwind) to refine the websiteHello everyone! We are looking for a skilled frontend developer to help us finish the website of a premium plastic surgery clinic. The situation is as follows: the site has been designed and built using two AIs — the logic, structure, and code were created through neural… Web Programming, Web Design ∙ 5 hours 28 minutes back ∙ 37 proposals |
Development of 2 SEO-oriented websites for selling spare parts (ATVs and special equipment)Development of Two Specialized Websites for Selling Spare PartsGeneral Information It is necessary to develop two specialized websites: Spare parts for ATVs, UTVs, SSVs, and other similar equipment. Spare parts for special equipment. Existing company website:… PHP, Web Programming ∙ 15 hours 15 minutes back ∙ 50 proposals |
Need a 1C specialist (Trade Management)
23 USD
Need a 1C specialist (Trade Management) We are looking for an experienced 1C programmer for a small integration project. We have an online store and a 1C UT configuration. It is necessary to set up data exchange between the website and 1C — so that the website can receive… System & Network Administration, Web Programming ∙ 18 hours 26 minutes back ∙ 12 proposals |