i want try fullpage scrol 100vh












0














i want to try fullpage scroll 100vh on every scroll event but
its showing an error Property 'detail' and wheelDelta does not exist on type 'Event' in this line

if (e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0)



my about.ts file are



      ngOnInit() {

// snapy fullpage scroll

$(document).ready(function () {
var divs = $('.mydiv');
var dir = 'up'; // wheel scroll direction
var div = 0; // current div
$(document.body).on('DOMMouseScroll mousewheel', function (e) {
if (e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0) {
dir = 'down';
} else {
dir = 'up';
}
// find currently visible div :
div = -1;
divs.each(function(i){
if (div<0 && ($(this).offset().top >= $(window).scrollTop())) {
div = i;
}
});
if (dir == 'up' && div > 0) {
div--;
}
if (dir == 'down' && div < divs.length) {
div++;
}
//console.log(div, dir, divs.length);
$('html,body').stop().animate({
scrollTop: divs.eq(div).offset().top
}, 200);
return false;
});
$(window).resize(function () {
$('html,body').scrollTop(divs.eq(div).offset().top);
});
});
}


.html file are



<div class="mydiv" style="text-align:center; color:green">Gallery</div>
<div class="mydiv" style="background-color: #aaa">Page 1</div>
<div class="mydiv" style="background-color: #444">Page 2</div>
<div class="mydiv" style="background-color: blue">Page 3</div>
<div class="mydiv" style="background-color: #ccc">Page 4</div>
<div class="mydiv" style="background-color: yellow">Page 5</div>


.css file are



html, body, body>div {
height:100%;
color:yellow;
}









share|improve this question






















  • Is it about.js or about.ts?
    – Liam Strilchuk
    Nov 11 at 14:25












  • .ts i doing this in angular6
    – Shubham Singh
    Nov 11 at 14:26
















0














i want to try fullpage scroll 100vh on every scroll event but
its showing an error Property 'detail' and wheelDelta does not exist on type 'Event' in this line

if (e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0)



my about.ts file are



      ngOnInit() {

// snapy fullpage scroll

$(document).ready(function () {
var divs = $('.mydiv');
var dir = 'up'; // wheel scroll direction
var div = 0; // current div
$(document.body).on('DOMMouseScroll mousewheel', function (e) {
if (e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0) {
dir = 'down';
} else {
dir = 'up';
}
// find currently visible div :
div = -1;
divs.each(function(i){
if (div<0 && ($(this).offset().top >= $(window).scrollTop())) {
div = i;
}
});
if (dir == 'up' && div > 0) {
div--;
}
if (dir == 'down' && div < divs.length) {
div++;
}
//console.log(div, dir, divs.length);
$('html,body').stop().animate({
scrollTop: divs.eq(div).offset().top
}, 200);
return false;
});
$(window).resize(function () {
$('html,body').scrollTop(divs.eq(div).offset().top);
});
});
}


.html file are



<div class="mydiv" style="text-align:center; color:green">Gallery</div>
<div class="mydiv" style="background-color: #aaa">Page 1</div>
<div class="mydiv" style="background-color: #444">Page 2</div>
<div class="mydiv" style="background-color: blue">Page 3</div>
<div class="mydiv" style="background-color: #ccc">Page 4</div>
<div class="mydiv" style="background-color: yellow">Page 5</div>


.css file are



html, body, body>div {
height:100%;
color:yellow;
}









share|improve this question






















  • Is it about.js or about.ts?
    – Liam Strilchuk
    Nov 11 at 14:25












  • .ts i doing this in angular6
    – Shubham Singh
    Nov 11 at 14:26














0












0








0







i want to try fullpage scroll 100vh on every scroll event but
its showing an error Property 'detail' and wheelDelta does not exist on type 'Event' in this line

if (e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0)



my about.ts file are



      ngOnInit() {

// snapy fullpage scroll

$(document).ready(function () {
var divs = $('.mydiv');
var dir = 'up'; // wheel scroll direction
var div = 0; // current div
$(document.body).on('DOMMouseScroll mousewheel', function (e) {
if (e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0) {
dir = 'down';
} else {
dir = 'up';
}
// find currently visible div :
div = -1;
divs.each(function(i){
if (div<0 && ($(this).offset().top >= $(window).scrollTop())) {
div = i;
}
});
if (dir == 'up' && div > 0) {
div--;
}
if (dir == 'down' && div < divs.length) {
div++;
}
//console.log(div, dir, divs.length);
$('html,body').stop().animate({
scrollTop: divs.eq(div).offset().top
}, 200);
return false;
});
$(window).resize(function () {
$('html,body').scrollTop(divs.eq(div).offset().top);
});
});
}


.html file are



<div class="mydiv" style="text-align:center; color:green">Gallery</div>
<div class="mydiv" style="background-color: #aaa">Page 1</div>
<div class="mydiv" style="background-color: #444">Page 2</div>
<div class="mydiv" style="background-color: blue">Page 3</div>
<div class="mydiv" style="background-color: #ccc">Page 4</div>
<div class="mydiv" style="background-color: yellow">Page 5</div>


.css file are



html, body, body>div {
height:100%;
color:yellow;
}









share|improve this question













i want to try fullpage scroll 100vh on every scroll event but
its showing an error Property 'detail' and wheelDelta does not exist on type 'Event' in this line

if (e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0)



my about.ts file are



      ngOnInit() {

// snapy fullpage scroll

$(document).ready(function () {
var divs = $('.mydiv');
var dir = 'up'; // wheel scroll direction
var div = 0; // current div
$(document.body).on('DOMMouseScroll mousewheel', function (e) {
if (e.originalEvent.detail > 0 || e.originalEvent.wheelDelta < 0) {
dir = 'down';
} else {
dir = 'up';
}
// find currently visible div :
div = -1;
divs.each(function(i){
if (div<0 && ($(this).offset().top >= $(window).scrollTop())) {
div = i;
}
});
if (dir == 'up' && div > 0) {
div--;
}
if (dir == 'down' && div < divs.length) {
div++;
}
//console.log(div, dir, divs.length);
$('html,body').stop().animate({
scrollTop: divs.eq(div).offset().top
}, 200);
return false;
});
$(window).resize(function () {
$('html,body').scrollTop(divs.eq(div).offset().top);
});
});
}


.html file are



<div class="mydiv" style="text-align:center; color:green">Gallery</div>
<div class="mydiv" style="background-color: #aaa">Page 1</div>
<div class="mydiv" style="background-color: #444">Page 2</div>
<div class="mydiv" style="background-color: blue">Page 3</div>
<div class="mydiv" style="background-color: #ccc">Page 4</div>
<div class="mydiv" style="background-color: yellow">Page 5</div>


.css file are



html, body, body>div {
height:100%;
color:yellow;
}






javascript jquery angular6






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 14:21









Shubham Singh

188




188












  • Is it about.js or about.ts?
    – Liam Strilchuk
    Nov 11 at 14:25












  • .ts i doing this in angular6
    – Shubham Singh
    Nov 11 at 14:26


















  • Is it about.js or about.ts?
    – Liam Strilchuk
    Nov 11 at 14:25












  • .ts i doing this in angular6
    – Shubham Singh
    Nov 11 at 14:26
















Is it about.js or about.ts?
– Liam Strilchuk
Nov 11 at 14:25






Is it about.js or about.ts?
– Liam Strilchuk
Nov 11 at 14:25














.ts i doing this in angular6
– Shubham Singh
Nov 11 at 14:26




.ts i doing this in angular6
– Shubham Singh
Nov 11 at 14:26

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249648%2fi-want-try-fullpage-scrol-100vh%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53249648%2fi-want-try-fullpage-scrol-100vh%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini