Smooth scroll working for navbar, but not other elements (arrows etc)
up vote
1
down vote
favorite
I have a Rails application that uses a jQuery smooth scrolling function. The smooth scroll works for the navbar links, but not for the 'scroll down' arrow or 'back to top' arrow. I've tried adding a script tag to implement the behavior directly on the element, but no luck. Any recommendations are appreciated!
Here is the scroll function -
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^//, '') == this.pathname.replace(/^//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
});
Here is the block containing the down arrow. The parens with (some text here) are not in my actual code, I just changed it for S/O. -
<div class="typebox" style="min-height: 119px;">
<div id="typed-strings">
<h3 class="type-active"><strong style="font-size: 20px; line-height: 1.5em;"> (some text here) <br> (some more text here) <br><br><a href="#web-apps"><%= image_tag "down-arrow.png", class: "down-arrow"%></a></strong></h3>
</div>
<span id="typed"></span>
<br />
</div>
jquery html ruby-on-rails scroll
add a comment |
up vote
1
down vote
favorite
I have a Rails application that uses a jQuery smooth scrolling function. The smooth scroll works for the navbar links, but not for the 'scroll down' arrow or 'back to top' arrow. I've tried adding a script tag to implement the behavior directly on the element, but no luck. Any recommendations are appreciated!
Here is the scroll function -
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^//, '') == this.pathname.replace(/^//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
});
Here is the block containing the down arrow. The parens with (some text here) are not in my actual code, I just changed it for S/O. -
<div class="typebox" style="min-height: 119px;">
<div id="typed-strings">
<h3 class="type-active"><strong style="font-size: 20px; line-height: 1.5em;"> (some text here) <br> (some more text here) <br><br><a href="#web-apps"><%= image_tag "down-arrow.png", class: "down-arrow"%></a></strong></h3>
</div>
<span id="typed"></span>
<br />
</div>
jquery html ruby-on-rails scroll
Is the click triggering the callback? Did you check iftarget
is found on that function? put a breakpoint on the lineif (target.length)
and you can inspect thetarget
variable. Can you create a codepen/jsfiddle to reproduce the problem?
– arieljuod
Nov 10 at 4:45
I'm not super familiar with breakpoints yet, but here's a link to my site. www.justincefai.co
– Justin Cefai
Nov 10 at 23:44
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a Rails application that uses a jQuery smooth scrolling function. The smooth scroll works for the navbar links, but not for the 'scroll down' arrow or 'back to top' arrow. I've tried adding a script tag to implement the behavior directly on the element, but no luck. Any recommendations are appreciated!
Here is the scroll function -
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^//, '') == this.pathname.replace(/^//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
});
Here is the block containing the down arrow. The parens with (some text here) are not in my actual code, I just changed it for S/O. -
<div class="typebox" style="min-height: 119px;">
<div id="typed-strings">
<h3 class="type-active"><strong style="font-size: 20px; line-height: 1.5em;"> (some text here) <br> (some more text here) <br><br><a href="#web-apps"><%= image_tag "down-arrow.png", class: "down-arrow"%></a></strong></h3>
</div>
<span id="typed"></span>
<br />
</div>
jquery html ruby-on-rails scroll
I have a Rails application that uses a jQuery smooth scrolling function. The smooth scroll works for the navbar links, but not for the 'scroll down' arrow or 'back to top' arrow. I've tried adding a script tag to implement the behavior directly on the element, but no luck. Any recommendations are appreciated!
Here is the scroll function -
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^//, '') == this.pathname.replace(/^//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
});
Here is the block containing the down arrow. The parens with (some text here) are not in my actual code, I just changed it for S/O. -
<div class="typebox" style="min-height: 119px;">
<div id="typed-strings">
<h3 class="type-active"><strong style="font-size: 20px; line-height: 1.5em;"> (some text here) <br> (some more text here) <br><br><a href="#web-apps"><%= image_tag "down-arrow.png", class: "down-arrow"%></a></strong></h3>
</div>
<span id="typed"></span>
<br />
</div>
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^//, '') == this.pathname.replace(/^//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
});
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^//, '') == this.pathname.replace(/^//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
});
<div class="typebox" style="min-height: 119px;">
<div id="typed-strings">
<h3 class="type-active"><strong style="font-size: 20px; line-height: 1.5em;"> (some text here) <br> (some more text here) <br><br><a href="#web-apps"><%= image_tag "down-arrow.png", class: "down-arrow"%></a></strong></h3>
</div>
<span id="typed"></span>
<br />
</div>
<div class="typebox" style="min-height: 119px;">
<div id="typed-strings">
<h3 class="type-active"><strong style="font-size: 20px; line-height: 1.5em;"> (some text here) <br> (some more text here) <br><br><a href="#web-apps"><%= image_tag "down-arrow.png", class: "down-arrow"%></a></strong></h3>
</div>
<span id="typed"></span>
<br />
</div>
jquery html ruby-on-rails scroll
jquery html ruby-on-rails scroll
asked Nov 9 at 21:19
Justin Cefai
2617
2617
Is the click triggering the callback? Did you check iftarget
is found on that function? put a breakpoint on the lineif (target.length)
and you can inspect thetarget
variable. Can you create a codepen/jsfiddle to reproduce the problem?
– arieljuod
Nov 10 at 4:45
I'm not super familiar with breakpoints yet, but here's a link to my site. www.justincefai.co
– Justin Cefai
Nov 10 at 23:44
add a comment |
Is the click triggering the callback? Did you check iftarget
is found on that function? put a breakpoint on the lineif (target.length)
and you can inspect thetarget
variable. Can you create a codepen/jsfiddle to reproduce the problem?
– arieljuod
Nov 10 at 4:45
I'm not super familiar with breakpoints yet, but here's a link to my site. www.justincefai.co
– Justin Cefai
Nov 10 at 23:44
Is the click triggering the callback? Did you check if
target
is found on that function? put a breakpoint on the line if (target.length)
and you can inspect the target
variable. Can you create a codepen/jsfiddle to reproduce the problem?– arieljuod
Nov 10 at 4:45
Is the click triggering the callback? Did you check if
target
is found on that function? put a breakpoint on the line if (target.length)
and you can inspect the target
variable. Can you create a codepen/jsfiddle to reproduce the problem?– arieljuod
Nov 10 at 4:45
I'm not super familiar with breakpoints yet, but here's a link to my site. www.justincefai.co
– Justin Cefai
Nov 10 at 23:44
I'm not super familiar with breakpoints yet, but here's a link to my site. www.justincefai.co
– Justin Cefai
Nov 10 at 23:44
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
I cannot find your code on the link, but seeing your website I can think of a few things:
1) your down arrow is not there when you set the click callback, it's added later with that typed effect so the click callback is not set on that A tag. I guess the library you used for that has some event to let you know that the effect is finished, then you can set the callback for that A tag
2) the back to top arrow has href="#"
which is explicittly NOT selected for the click function with the line .not('[href="#"]')
, I'm guessing you copied the function from somewhere else, you can add an id after the href for that back to top A tag and add an element wit that ID at the top of the site
EDIT: to fix the down arrow event listener, I would do this:
1st, move the function outside the parameters
function scroll_to_hash(event) {
// On-page links
if (
location.pathname.replace(/^//, '') == this.pathname.replace(/^//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
}
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(scroll_to_hash);
2nd, I'm guessing you are using Typed.js, you have an onComplete
callback https://mattboldt.com/typed.js/docs/, you can then set the click event for the down arrow on that callback on the options when you initialize the plugin
onComplete: function(self) {
$('a[href="#web-apps"]').click(scroll_to_hash)
}
Nice, thanks for that! Super easy fix for the back to top arrow. However, I don't quite follow how I would go about setting the callback for the down arrow.
– Justin Cefai
Nov 11 at 1:45
Check my last edit.
– arieljuod
Nov 11 at 1:53
Yeah exactly, it's Typed.js. Ok, so the smooth scroll is working now (thanks!), but the typed.js behavior has stopped working. I'm going to continue to play around with it, but if you have any ideas I'm down to hear them!
– Justin Cefai
Nov 11 at 3:25
I found this thread where he seems to be addressing a similar issue, but the fix he recommends gives me the same error I was getting before. github.com/mattboldt/typed.js/issues/341
– Justin Cefai
Nov 11 at 3:53
Add your current code to the question, I'm not sure what it looks right now, show the part where you initialize the Typed function.
– arieljuod
Nov 11 at 4:02
|
show 3 more comments
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I cannot find your code on the link, but seeing your website I can think of a few things:
1) your down arrow is not there when you set the click callback, it's added later with that typed effect so the click callback is not set on that A tag. I guess the library you used for that has some event to let you know that the effect is finished, then you can set the callback for that A tag
2) the back to top arrow has href="#"
which is explicittly NOT selected for the click function with the line .not('[href="#"]')
, I'm guessing you copied the function from somewhere else, you can add an id after the href for that back to top A tag and add an element wit that ID at the top of the site
EDIT: to fix the down arrow event listener, I would do this:
1st, move the function outside the parameters
function scroll_to_hash(event) {
// On-page links
if (
location.pathname.replace(/^//, '') == this.pathname.replace(/^//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
}
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(scroll_to_hash);
2nd, I'm guessing you are using Typed.js, you have an onComplete
callback https://mattboldt.com/typed.js/docs/, you can then set the click event for the down arrow on that callback on the options when you initialize the plugin
onComplete: function(self) {
$('a[href="#web-apps"]').click(scroll_to_hash)
}
Nice, thanks for that! Super easy fix for the back to top arrow. However, I don't quite follow how I would go about setting the callback for the down arrow.
– Justin Cefai
Nov 11 at 1:45
Check my last edit.
– arieljuod
Nov 11 at 1:53
Yeah exactly, it's Typed.js. Ok, so the smooth scroll is working now (thanks!), but the typed.js behavior has stopped working. I'm going to continue to play around with it, but if you have any ideas I'm down to hear them!
– Justin Cefai
Nov 11 at 3:25
I found this thread where he seems to be addressing a similar issue, but the fix he recommends gives me the same error I was getting before. github.com/mattboldt/typed.js/issues/341
– Justin Cefai
Nov 11 at 3:53
Add your current code to the question, I'm not sure what it looks right now, show the part where you initialize the Typed function.
– arieljuod
Nov 11 at 4:02
|
show 3 more comments
up vote
0
down vote
I cannot find your code on the link, but seeing your website I can think of a few things:
1) your down arrow is not there when you set the click callback, it's added later with that typed effect so the click callback is not set on that A tag. I guess the library you used for that has some event to let you know that the effect is finished, then you can set the callback for that A tag
2) the back to top arrow has href="#"
which is explicittly NOT selected for the click function with the line .not('[href="#"]')
, I'm guessing you copied the function from somewhere else, you can add an id after the href for that back to top A tag and add an element wit that ID at the top of the site
EDIT: to fix the down arrow event listener, I would do this:
1st, move the function outside the parameters
function scroll_to_hash(event) {
// On-page links
if (
location.pathname.replace(/^//, '') == this.pathname.replace(/^//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
}
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(scroll_to_hash);
2nd, I'm guessing you are using Typed.js, you have an onComplete
callback https://mattboldt.com/typed.js/docs/, you can then set the click event for the down arrow on that callback on the options when you initialize the plugin
onComplete: function(self) {
$('a[href="#web-apps"]').click(scroll_to_hash)
}
Nice, thanks for that! Super easy fix for the back to top arrow. However, I don't quite follow how I would go about setting the callback for the down arrow.
– Justin Cefai
Nov 11 at 1:45
Check my last edit.
– arieljuod
Nov 11 at 1:53
Yeah exactly, it's Typed.js. Ok, so the smooth scroll is working now (thanks!), but the typed.js behavior has stopped working. I'm going to continue to play around with it, but if you have any ideas I'm down to hear them!
– Justin Cefai
Nov 11 at 3:25
I found this thread where he seems to be addressing a similar issue, but the fix he recommends gives me the same error I was getting before. github.com/mattboldt/typed.js/issues/341
– Justin Cefai
Nov 11 at 3:53
Add your current code to the question, I'm not sure what it looks right now, show the part where you initialize the Typed function.
– arieljuod
Nov 11 at 4:02
|
show 3 more comments
up vote
0
down vote
up vote
0
down vote
I cannot find your code on the link, but seeing your website I can think of a few things:
1) your down arrow is not there when you set the click callback, it's added later with that typed effect so the click callback is not set on that A tag. I guess the library you used for that has some event to let you know that the effect is finished, then you can set the callback for that A tag
2) the back to top arrow has href="#"
which is explicittly NOT selected for the click function with the line .not('[href="#"]')
, I'm guessing you copied the function from somewhere else, you can add an id after the href for that back to top A tag and add an element wit that ID at the top of the site
EDIT: to fix the down arrow event listener, I would do this:
1st, move the function outside the parameters
function scroll_to_hash(event) {
// On-page links
if (
location.pathname.replace(/^//, '') == this.pathname.replace(/^//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
}
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(scroll_to_hash);
2nd, I'm guessing you are using Typed.js, you have an onComplete
callback https://mattboldt.com/typed.js/docs/, you can then set the click event for the down arrow on that callback on the options when you initialize the plugin
onComplete: function(self) {
$('a[href="#web-apps"]').click(scroll_to_hash)
}
I cannot find your code on the link, but seeing your website I can think of a few things:
1) your down arrow is not there when you set the click callback, it's added later with that typed effect so the click callback is not set on that A tag. I guess the library you used for that has some event to let you know that the effect is finished, then you can set the callback for that A tag
2) the back to top arrow has href="#"
which is explicittly NOT selected for the click function with the line .not('[href="#"]')
, I'm guessing you copied the function from somewhere else, you can add an id after the href for that back to top A tag and add an element wit that ID at the top of the site
EDIT: to fix the down arrow event listener, I would do this:
1st, move the function outside the parameters
function scroll_to_hash(event) {
// On-page links
if (
location.pathname.replace(/^//, '') == this.pathname.replace(/^//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
}
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(scroll_to_hash);
2nd, I'm guessing you are using Typed.js, you have an onComplete
callback https://mattboldt.com/typed.js/docs/, you can then set the click event for the down arrow on that callback on the options when you initialize the plugin
onComplete: function(self) {
$('a[href="#web-apps"]').click(scroll_to_hash)
}
edited Nov 11 at 1:53
answered Nov 11 at 0:43
arieljuod
5,69711121
5,69711121
Nice, thanks for that! Super easy fix for the back to top arrow. However, I don't quite follow how I would go about setting the callback for the down arrow.
– Justin Cefai
Nov 11 at 1:45
Check my last edit.
– arieljuod
Nov 11 at 1:53
Yeah exactly, it's Typed.js. Ok, so the smooth scroll is working now (thanks!), but the typed.js behavior has stopped working. I'm going to continue to play around with it, but if you have any ideas I'm down to hear them!
– Justin Cefai
Nov 11 at 3:25
I found this thread where he seems to be addressing a similar issue, but the fix he recommends gives me the same error I was getting before. github.com/mattboldt/typed.js/issues/341
– Justin Cefai
Nov 11 at 3:53
Add your current code to the question, I'm not sure what it looks right now, show the part where you initialize the Typed function.
– arieljuod
Nov 11 at 4:02
|
show 3 more comments
Nice, thanks for that! Super easy fix for the back to top arrow. However, I don't quite follow how I would go about setting the callback for the down arrow.
– Justin Cefai
Nov 11 at 1:45
Check my last edit.
– arieljuod
Nov 11 at 1:53
Yeah exactly, it's Typed.js. Ok, so the smooth scroll is working now (thanks!), but the typed.js behavior has stopped working. I'm going to continue to play around with it, but if you have any ideas I'm down to hear them!
– Justin Cefai
Nov 11 at 3:25
I found this thread where he seems to be addressing a similar issue, but the fix he recommends gives me the same error I was getting before. github.com/mattboldt/typed.js/issues/341
– Justin Cefai
Nov 11 at 3:53
Add your current code to the question, I'm not sure what it looks right now, show the part where you initialize the Typed function.
– arieljuod
Nov 11 at 4:02
Nice, thanks for that! Super easy fix for the back to top arrow. However, I don't quite follow how I would go about setting the callback for the down arrow.
– Justin Cefai
Nov 11 at 1:45
Nice, thanks for that! Super easy fix for the back to top arrow. However, I don't quite follow how I would go about setting the callback for the down arrow.
– Justin Cefai
Nov 11 at 1:45
Check my last edit.
– arieljuod
Nov 11 at 1:53
Check my last edit.
– arieljuod
Nov 11 at 1:53
Yeah exactly, it's Typed.js. Ok, so the smooth scroll is working now (thanks!), but the typed.js behavior has stopped working. I'm going to continue to play around with it, but if you have any ideas I'm down to hear them!
– Justin Cefai
Nov 11 at 3:25
Yeah exactly, it's Typed.js. Ok, so the smooth scroll is working now (thanks!), but the typed.js behavior has stopped working. I'm going to continue to play around with it, but if you have any ideas I'm down to hear them!
– Justin Cefai
Nov 11 at 3:25
I found this thread where he seems to be addressing a similar issue, but the fix he recommends gives me the same error I was getting before. github.com/mattboldt/typed.js/issues/341
– Justin Cefai
Nov 11 at 3:53
I found this thread where he seems to be addressing a similar issue, but the fix he recommends gives me the same error I was getting before. github.com/mattboldt/typed.js/issues/341
– Justin Cefai
Nov 11 at 3:53
Add your current code to the question, I'm not sure what it looks right now, show the part where you initialize the Typed function.
– arieljuod
Nov 11 at 4:02
Add your current code to the question, I'm not sure what it looks right now, show the part where you initialize the Typed function.
– arieljuod
Nov 11 at 4:02
|
show 3 more comments
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233405%2fsmooth-scroll-working-for-navbar-but-not-other-elements-arrows-etc%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Is the click triggering the callback? Did you check if
target
is found on that function? put a breakpoint on the lineif (target.length)
and you can inspect thetarget
variable. Can you create a codepen/jsfiddle to reproduce the problem?– arieljuod
Nov 10 at 4:45
I'm not super familiar with breakpoints yet, but here's a link to my site. www.justincefai.co
– Justin Cefai
Nov 10 at 23:44