Teddy_c
Forum Replies Created
-
Thank you very much for the explanation! Really helpful
Forum: Fixing WordPress
In reply to: Problem loading jQuery hosted libraryProblem fixed thanks to Dwiden. Please find his answer bellow:
——— Solution ———-
Bug and you are using incorrect code in the functions.php file. If the Enqueue safe version of jQuery checkbox is still displayed and it is enabled please disable it and then click on the Save All Changes button.
Then in the functions.php file of your child theme change your code to look like this (perhaps best to do a copy\paste):
function mytheme_jquery_script() { wp_deregister_script( 'jquery' ); wp_deregister_script( 'jquery-core' ); wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js', array(), '2.1.4', false); wp_enqueue_script( 'jquery' ); }
add_action( ‘wp_enqueue_scripts’, ‘mytheme_jquery_script’);
If you already have a method\function being added as an action to the wp_enqueue_scripts hook in the theme functions.php file you can add all lines starting with wp_ at the end of that method\function. The rest is then obsolete (because it is probably already there).This should fix it.
In the Enqueue safe version of jQuery setting click on the ‘click here to check again.’ link to obtain the JQuery version being used and then refresh the iTSec plugin Settings page. It should now report in green:
Your current jQuery version is 2.1.4.
If the above info helped you solve the issue please mark this topic as ‘resolved’.
dwinden
Just a little note for anyone having the same issue, instead of writing:
“ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js”
write:
“https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js”
Thanks again Dwinden
Awesome, it worked perfectly.
Thank you! Do you think you could explain me what happened?
Forum: Fixing WordPress
In reply to: Problem loading jQuery hosted libraryEverything worked perfectly before for me too. Ever since I check and uncheck this box in itheme security it stopped working
Forum: Fixing WordPress
In reply to: Problem loading jQuery hosted libraryThank you, unfortunately it does not work. Here is my website by the way
https://www.thesofachronicle.com
Also, the version of jQuery I am trying to implement is the 2.1.4 and not the 1.4
Forum: Fixing WordPress
In reply to: Hide header on scroll down, show on scroll upHere is my script
var didScroll; var lastScrollTop = 0; var delta = 5; var navbarHeight = $('.main-navigation').outerHeight(); $(window).scroll(function (event) { didScroll = true; }); setInterval(function () { if (didScroll) { hasScrolled(); didScroll = false; } }, 250); function hasScrolled() { var st = $(this).scrollTop(); // Make sure they scroll more than delta if (Math.abs(lastScrollTop - st) <= delta) return; // If they scrolled down and are past the navbar, add class .nav-up. if (st > lastScrollTop && st > navbarHeight) { // Scroll Down $('.main-navigation').removeClass('nav-down').addClass('nav-up'); } else { // Scroll Up if (st + $(window).height() < $(document).height()) { $('.main-navigation').removeClass('nav-up').addClass('nav-down'); } } lastScrollTop = st; }
I am trying to implement this script at the beginning to execute my script once people have scroll down to my nav bar and stop the script once they have scrolled back up to my nav bar but I am having problems. It does not work.
var reachedFromTop = false; var reachedFromBottom = false; $(window).scroll(function() { //After scrolling 100px from the top... if ($(window).scrollTop() > 100 ) { if (!reachedFromTop) something(); reachedFromTop = true; } else if (reachedFromTop && otherCondition) { if (!reachedFromBottom) somethingElse(); reachedFromBottom = true; } });
Forum: Fixing WordPress
In reply to: Hide header on scroll down, show on scroll upWhat I would ultimately love to do will be to make the script start after it passes my navigation bar and stop once it reached the bottom of the Navigation bar
Forum: Fixing WordPress
In reply to: Hide header on scroll down, show on scroll upYes my css is good, I have even tried with the one you sent and so what’s happening is that my navigation bar does not go back to its initial place and format once I have reached its initial position.
The JS is still applying.
Forum: Fixing WordPress
In reply to: Hide header on scroll down, show on scroll upThank you for the code. It is actually working and the class nav-down is adding on scroll up.
However, once I have reached the top of my window, the class nav-down stays and I end up with a weird effect. it doesn’t retrieve its initial layout.
Do you know how I can fix that?
Forum: Fixing WordPress
In reply to: .addClass JS/JQUERYI got it. I just forgot to actually call my function in my js file.
Thank you very much for the help Stephen, I do appreciate and I could have had it worked without your help.
Forum: Fixing WordPress
In reply to: .addClass JS/JQUERYI finally got my script to load in the page, however it is not working. I think it is a script problem now.
Forum: Fixing WordPress
In reply to: .addClass JS/JQUERYDoes it have anything to do with the fact that I am on a local server?
Forum: Fixing WordPress
In reply to: .addClass JS/JQUERYfunction penscratch_child_script() {
wp_enqueue_script( ‘sticky’, get_stylesheet_directory_uri() . ‘/js/sticky.js’, true);
}
add_action( ‘wp_enqueue_scripts’, ‘penscratch_child_script’ );my sticky.js script is local=ted in a js folder in my child theme folder
Forum: Fixing WordPress
In reply to: .addClass JS/JQUERYI have just realized that my script is not loading in the page when I look for it on google chrome, view source.