Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
156
rated 0 times [  163] [ 7]  / answers: 1 / hits: 17040  / 11 Years ago, sat, february 22, 2014, 12:00:00

I'm using WordPress 3.8.1. I want to use this function to use sticky header



<script>
$(document).ready(function() {
var $header = $(header),
$clone = $header.before($header.clone().addClass(clone));

$(window).on(scroll, function() {
var fromTop = $(window).scrollTop();
console.log(fromTop);
$(body).toggleClass(down, (fromTop > 200));
});
});
</script>


But it is not working for me and I don't know why. I know that jQuery is shared to my WordPress because Flexslider 2 is now working fine.


More From » jquery

 Answers
11

Add this:



var j = jQuery.noConflict();


Now you can write your jQuery code like this:



j(document).ready(function(){
j('.class').event(function(){

// your action............

});
});


Just assign the noConflict() function to a variable, and use that variable instead of $ seen in jQuery code.


[#72380] Thursday, February 20, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
felixa

Total Points: 180
Total Questions: 113
Total Answers: 108

Location: Palau
Member since Sat, Aug 21, 2021
3 Years ago
;