I'm on wordpress, I want to change default logo when the header becomes sticky:
class .is-sticky
appears and that's important.
( Also I'm using small plugin for transliteration - cyrillic to latin script, at the same time I'll be able to change sticky logo depending on current alphabet, because body
have class body.cir
or body.lat
if is cyrillic/latin )
css targeting works fine, for example:
body.lat .is-sticky img.kad-standard-logo{
border: solid 1px red;
}
body.cir .is-sticky img.kad-standard-logo{
border: solid 1px blue;
}
or just to be more precise, (not to be confused with my alphabet classes)
, .is-sticky
class appears on page scroll and then I want to change logo,
adding border for example:
.is-sticky img.kad-standard-logo{
border: solid 1px red;
}
It's OK.
I don't want to use:
content: url(logo.png)
background: url(logo.png)
I'm trying to change logo like this but it doesn't work :
jQuery(function($) {
var cyril = "https://mysite.domain/images/logo_sticky-cir.png";
var lats ="https://mysite.domain/images/logo_sticky-lat.png" ;
var logoDefault = $('.kad-standard-logo').attr('src'); //Wordpress theme options default logo
$('body.cir .is-sticky img.kad-standard-logo').attr('src', cyril);
$('body.lat .is-sticky img.kad-standard-logo').attr('src', lats);
});
Maybe class .is-sticky
is in some conflict, because it's from main scripts for sticky header or whatever and when is excluded from script:
$('body.cir img.kad-standard-logo').attr('src', cyril);
$('body.lat img.kad-standard-logo').attr('src', lats);
or just
$('img.kad-standard-logo').attr('src', lats);
it works,
but I need when .is-sticky
I hope this description is understandable,
Any suggestions, please,
Thanks.