Custom js is in comment
Hi,
I would like to add a new javascript, but in the front, it is added in comment as below
--------------------
<script id="mfn-dnmc-custom-js">
//<![CDATA[
var elementPosition = $('.bg-fix').offset();
$(window).scroll(function(){
if($(window).scrollTop() > elementPosition.top){
$('.bg-fix').css('position','fixed').css('top','0');
} else {
$('.bg-fix').css('position','static');
}
});
//]]>
</script>
-----------
An idea to activate it ?
thanks.
Regards
I would like to add a new javascript, but in the front, it is added in comment as below
--------------------
<script id="mfn-dnmc-custom-js">
//<![CDATA[
var elementPosition = $('.bg-fix').offset();
$(window).scroll(function(){
if($(window).scrollTop() > elementPosition.top){
$('.bg-fix').css('position','fixed').css('top','0');
} else {
$('.bg-fix').css('position','static');
}
});
//]]>
</script>
-----------
An idea to activate it ?
thanks.
Regards
Comments
maybe you pasted it with comment tags in theme options>custom css&js>JS ??
Please send us what you pasted there.
thanks
$(window).scroll(function(){
if($(window).scrollTop() > elementPosition.top){
$('.bg-fix').css('position','fixed').css('top','0');
} else {
$('.bg-fix').css('position','static');
}
});
To use jQuery code wrap it into jQuery(function($){ ... });
^:)^