I try to implement the effect of changing svg images by using jQuery. My code works in the browser but it returns error in the console. I want to remove the error. What should I do?
Error
(unknown) Uncaught TypeError: a[b].target.className.indexOf is not a function
jQuery
$(document).ready(function() {
$(window).scroll(function(){
var ScrollTop = parseInt($(window).scrollTop());
if(ScrollTop > 150) {
$(".outer-wrapper").css("border-bottom","1px solid #cdc8c7");
$(".svg--logo").find("use").attr("xlink:href", "#billie-logo-sml");
} else {
$(".outer-wrapper").css("border-bottom","");
$(".svg--logo").find("use").attr("xlink:href", "#billie-logo");
}
})
})
HTML
<div class="header-item">
<a class="logo" href="{{ site.baseurl }}/">
<svg class="svg--logo">
<title>Billie Logo</title>
<use xlink:href="#billie-logo"/>
</svg>
</a>