Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter laonikoss

    (@laonikoss)

    I’m sorry, I’m an idiot.

    The answer to my question is Yes, I just did a search+replace, and it now works flawlessly.

    Thanks for your answers and patience – I am not too familiar with the ways of javascript, and learning it at the same time as getting used to the idiosyncracies of making it work within WordPress is a bit confusing!

    Thread Starter laonikoss

    (@laonikoss)

    Thanks for your comments:

    I corrected the content of the JS file.

    I have enqueued it successfully, and it DOES load. (It shows up in the HTML code of the page once loaded, and it works.)

    However, ONLY because I am hard-coding this onto <head>:

    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

    (This is the jQuery link that came with some of the code I am using.)

    As long as I have that in <head> it works fine. If I remove it, it breaks. Here’s the code I have in scroll.js again:

    jQuery(function() {
    	$('#nav').removeClass('scrolled');
        $(window).on('scroll', function() {
        	var viewportHeight = $(window).height();
        	if ($(window).scrollTop() < 0.8 * viewportHeight) {
    	        $('#par_background').css('margin-top', $(window).scrollTop() * -.3).css('opacity', 1 - ($(window).scrollTop() / (viewportHeight * 0.8)));
        	    $('#abs').text($(window).scrollTop() + '+' + viewportHeight + '+' + ($(window).scrollTop() / (viewportHeight * 0.8)));
        	}
        	else {
        		$('#par_background').css('opacity', '0');
        	}
        });
    
    });
    
    jQuery(document).ready(function () {
        $(window).bind('scroll', function () {
            var distance = 0.2 * $(window).height();
            if ($(window).scrollTop() > distance) {
                $('#nav').addClass('scrolled');
            } else {
                $('#nav').removeClass('scrolled');
            }
        });
    });

    I get an error in the console:

    Uncaught TypeError: $ is not a function

    Do I have to replace every instance of $ with jQuery in my JS file? Or just the one in the beginning of each function?

    Thanks!

    Thread Starter laonikoss

    (@laonikoss)

    Hey,

    Turned out problem is fixed now – I went to the permalinks page and I just changed the permalinks option to the default. It now works fine.

    If I changed the setting to anything other than “default” in the Settings – Permalinks page, I get an error, but if it’s left on “default” it works just fine.

    Thanks for your help, hope others also benefit from this somehow!

    Thread Starter laonikoss

    (@laonikoss)

    mod_rewrite is enabled on httpd.conf, I visited Permalinks page on settings.

    Restarted MAMP, problem remains:

    Not Found
    The requested URL /index.php was not found on this server.

    localhost:8888/website works fine (all styles load, admin page loads) but when I click to load the blog page, it loads localhost:8888/website/blog and gives the above error.

    I don’t see anything else I can do in that page. There’s nothing wrong with widgets or plugins, at the moment all plugins that might interfere with the website structure in some way (e.g. multi-lingual, minify, gzip etc) are disabled.

    Thread Starter laonikoss

    (@laonikoss)

    Thanks for the quick reply – there’s a few things I don’t understand here:

    “If you are using Permalinks, go to the Administration > Settings > Permalinks panel and update your Permalink structure to your .htaccess file, which should be in the same directory as the main index.php file.”

    How do I update my Permalink structure to my .htaccess file?

    Image and media works fine (I can even import/upload new media using the media gallery), also css.

Viewing 5 replies - 1 through 5 (of 5 total)