Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #108180

    Liquidator
    Participant

    Ok, guyz, i made one-page navigation website with other “Read More”-typed pages. So, when i try to go back from other pages through the menu i had a problem (because in the menu, they linked to #contend_band stuff). I searched the forum and found this code in Global Customiser.

    // Conditions
    // 1. Menu should be using full url, eg. http://site.com/#x-content-band-1 and not just #x-content-band-1
    // 2. Use just one menu for both Primary and One Page.
    
    jQuery(function($){
    	
    	var window_base = window.location.href.split("#").slice(0)[0];
    	var window_hash = window.location.href.split("#").slice(-1)[0];
    	var outbound = /^https?:///i;
    
    	$('.x-nav a').each(function(){ //Scan links and convert them to relative hash for one page navigation's Active statuses to work properly when manually scrolling
    
    		var hash = $(this).attr('href').split("#").slice(-1)[0];
    		var anchor_base = $(this).attr('href').split("#").slice(0)[0];
    
    	    if(hash) { //Does it have hash? then perform check
    		    if(anchor_base == window_base) { //If same page, then no need to reload, just make it relative
    		    	$(this).attr('href', '#'+hash);
    		    } // Else, leave it that way. So when user clicked, it will just link them to outbound page
    		}
    
    	}).click(function(e){ //Enable Parent and Submenu scrolling
    		
    		var hash = $(this).attr('href').split("#").slice(-1)[0];
    
    	    if(hash && !outbound.test( $(this).attr('href') ) ) { //Does it have relative hash?
    
    		    	e.preventDefault(); //Disable jumping
    		    	e.stopPropagation();
    
    		    	$('html,body').animate({ scrollTop: $('#' + hash ).offset().top - $('.x-navbar').height()},700 ,'swing');
    
    		    	//Now add active status for automatic scrolling
    		    	$('.x-nav li').removeClass('current-menu-item');
    		    	$(this).parent().addClass('current-menu-item');
    
    		}
    
    	});
    
    	$(document).ready(function(){ // Enable auto scroll when loaded.
    		
    		$('.x-nav li').removeClass('current-menu-item');
    		//$('a:not([href*="#"])').parent().addClass('current-menu-item'); For experiment only
    
    		if(window_hash) {
    			$('a[href$="#'+window_hash+'"]').click(); //Click it, so it will use default click from one page navigation event and submenu event
    		}
    	})
    
    });

    Moreover, when i erase this code from Javascript (Customiser page), it looks like this:

    Bug

    (As if all bands were active) + animation of navigation on homepage stops working.

    Menu worked from other pages, but some of my scripts broke. For example, go to this page:

    Hover on ALL images and move away the mouse cursor. You’ll notice that tooltip doesn’t goes away.

    Now, go here:
    Try to switch the tabs. They don’t work.

    Moreover, about optimisation:

    3. W3TC. Google Page Speed stuff shows that caching is not enabled. However, it’s not true. Something wrong.

    4. Minifying by gzip crashes my site, could you also please check it?

    5. Google also tells me that this scripts prepare to open proper my page:

    http://nar-logistics.kz/wp-includes/js/jquery/jquery.js
    http://nar-logistics.kz/…includes/js/jquery/jquery-migrate.min.js
    http://nar-logistics.kz/…s/x/framework/js/dist/site/x-head.min.js
    http://nar-logistics.kz/…es/js/dist/site/x-shortcodes-head.min.js
    http://nar-logistics.kz/…s/x/framework/js/dist/site/x-body.min.js
    http://nar-logistics.kz/wp-includes/js/comment-reply.min.js
    http://nar-logistics.kz/…es/js/dist/site/x-shortcodes-body.min.js

    Optimise this scripts also:
    http://nar-logistics.kz/wp-content/uploads/useanyfont/uaf.css
    http://nar-logistics.kz/…p-content/themes/x-child-renew/style.css
    http://nar-logistics.kz/…es/x/framework/css/site/stacks/renew.css
    http://fonts.googleapis.com/…o:900|Offside:400&subset=latin,latin-ext
    http://nar-logistics.kz/…ntent/plugins/x-shortcodes/css/renew.css

    Thank you!

    #108181

    Liquidator
    Participant
    This reply has been marked as private.
    #108246

    Rad
    Moderator

    Hi there,

    I guess you already found a way to make it work 🙂 Good job!

    You must only use cache/minify’s option recommended by your cache plugin. And gzip isn’t one of it’s option. Gzip compression is automatic when enabled and not totally related to minifier.

    Have you setup your minifier correctly? http://nar-logistics.kz/wp-admin/admin.php?page=w3tc_install

    Cheers!

    #108330

    Liquidator
    Participant

    Ok, support.

    I didn’t find a way to make it work! 🙂 So, i need your help on everything i wrote in the first post.

    P.S. I made a minifier setup correctly, btw “Browser Cache” option in W3TC crashes the website. (you can try it yourself)
    + Minifier option crashes site (100%)
    + One more question: How did you guyz make image before static menu on http://theme.co/x/ ? I’d like to do the same thing

    bug2
    wrong alignment. check it out, please.

    Waiting for response. Thank you.

    #108425

    Rad
    Moderator

    Hi there,

    Okay saw it, it’s not crashing but it links to no existing minified files. If the link isn’t found then you will lost some styling. Common cause are not properly installed minifier and not writable cache folder. We do not support 3rd party plugin troubleshooting. But you may provide ftp login so we could do some quick check up.

    Are you referring to fixed menu? You can enable it at Admin > Appearance > Customizer > Header > Navbar Position > Fixed Top.

    The alignment is just normal because you’re using column. Content from each column are independent to each other 🙂 The solution for that is using gap shortcode. Just add more gap space to align them accordingly.

    Cheers!

    #108552

    Liquidator
    Participant
    This reply has been marked as private.
    #108571

    Liquidator
    Participant

    UPD: Ok, i switched off W3TC and website looks OK, except 404 on “Read more” buttons on the main. However, those pages do exist.
    It’s not fixed menu! Go to your main demo http://theme.co/x/
    You see huge bg image and menu at the bottom. When you scroll down it becomes static! That’s what i’m saying.

    #108612

    Christopher
    Moderator

    Hi there,

    Please check http://theme.co/x/member/kb/sliders/,you can set slider above masthead and use fixed menu(which is now) to achieve the style.

    Hope it helps.

    #108646

    Liquidator
    Participant

    Ok, i figured out that 404 problem was because of bad .htaccess file. I restored it and now almost everything is ok.
    Except this:
    Open this link: http://nar-logistics.kz/price/
    Try to press any tab (they don’t work because of code on the first message).
    If i remove that JS code, navigation between homepage and other pages stop to work either. Help me please with fixing it.

    #108729

    Kosher K
    Member

    Hi,

    Can you please remove the previous code from your Customizer’s Javascript and add this code below instead in your Child theme functions.php

    add_action('wp_footer','additional_onepager_script');
    function additional_onepager_script() {
    	if ( !is_page(6643) ) { ?>
    <script id="custom-js">
    jQuery(function($){
    	
    	var window_base = window.location.href.split("#").slice(0)[0];
    	var window_hash = window.location.href.split("#").slice(-1)[0];
    	var outbound = /^https?:///i;
    
    	$('.x-nav a').each(function(){ 
    		var hash = $(this).attr('href').split("#").slice(-1)[0];
    		var anchor_base = $(this).attr('href').split("#").slice(0)[0];
    	    if(hash) { //Does it have hash? then perform check
    		    if(anchor_base == window_base) { //If same page, then no need to reload, just make it relative
    		    	$(this).attr('href', '#'+hash);
    		    } // Else, leave it that way. So when user clicked, it will just link them to outbound page
    		}
    	}).click(function(e){ //Enable Parent and Submenu scrolling
    		var hash = $(this).attr('href').split("#").slice(-1)[0];
    	    if(hash && !outbound.test( $(this).attr('href') ) ) { //Does it have relative hash?
    		    	e.preventDefault(); //Disable jumping
    		    	e.stopPropagation();
    		    	$('html,body').animate({ scrollTop: $('#' + hash ).offset().top - $('.x-navbar').height()},700 ,'swing');
    		    	$('.x-nav li').removeClass('current-menu-item');
    		    	$(this).parent().addClass('current-menu-item');
    		}
    
    	});
    	$(document).ready(function(){ // Enable auto scroll when loaded.
    		$('.x-nav li').removeClass('current-menu-item');
    		if(window_hash) {
    			$('a[href$="#'+window_hash+'"]').click(); //Click it, so it will use default click from one page navigation event and submenu event
    		}
    	})
    }); 
    </script>
    <?php
    	}
    }

    Let me know how it works.

    #108733

    Liquidator
    Participant

    1. All menu buttons are now underlined
    2. Animation stopped working (when you navigate between bands)
    3. Go to http://nar-logistics.kz/about_us/ Hover on all of those lightbox images and take the mouse cursor away. You will see that tooltip is still there.

    #108742

    Kosher K
    Member

    Hi There,

    I can see you have added it in Customizer > Custom > Javascript. Please DELETE IT from there

    The code I have provided is a PHP code and not a Javascript, you need to add it in child theme functions.php

    inside wp-content/themes/x-child-renew/functions.php

    or simply browse in Appearance > Editor > Make sure you are Editing Child theme > Click on functions.php and add that code,

    Hope that clarifies

    #108758

    Liquidator
    Participant

    Thaaaank you 😀 That’s why I failed to do that.
    1. Now, i need to remove this h1 title:
    remove

    2. Why does my jquery.js, init_embed.js, jquery.themepunch.tools.min.js weigh more than 90kb each (300kb for all of them), whether Renew02 demo’s (which is almost the copy of my page) JS files weigh not more than 100kb for all of them.

    3. Still can’t make gzip compression for my website.

    I put this code into .htaccess file:

    ## ENABLE GZIP COMPRESSION ##
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE application/xml
    AddOutputFilterByType DEFLATE application/xhtml+xml
    AddOutputFilterByType DEFLATE application/rss+xml
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    ## ENABLE GZIP COMPRESSION ##

    It didn’t work for me.

    4. Please, check this out:
    https://developers.google.com/speed/pagespeed/insights/?url=nar-logistics.kz&tab=desktop

    Analysis says that i have scripts that block the loading (probably because they’re in head and they wait until DOM is ready). Ok, i can deal with this, but also, i feel that i have 2 much scripts that i don’t even use. For instance, i don’t need blogs, portfolio, video and other stuff. Could you please tell me what scripts i can certainly delete?

    5. GO to theme.co/x Last time you guyz told me to do “Above masthead slider” to make such header background image. I did. But now, i don’t think it’s a great idea to use Revolution slider for one fixed image. Can’t I do this by code?

    Thank you.

    #108895

    Rad
    Moderator

    Hi there,

    Seems like there is a problem setting up minifier to your htaccess file. Instead, I disabled your minifier’s rewrite option. Now you can enable minifier and caching without breaking your site’s look.

    1. Add this css to hide your text logo.

    .x-brand {
    display: none;
    }
    

    2. They are javascript library used by most plugins and themes. And they are builtin to wordpress and slider. They are necessary to make your site works, more feature the larger it will be.

    3. We don’t usually support this issue as we’re not a webmaster but X support 🙂 You may contact a webmaster or optimization expert. Or contact your host provider to make it effective.

    4. Disabling minifier’s rewrite fixed these. CSS, Javascript, HTML are now minified and compressed. It’s now has higher scrore, since minifier is working now. You may play your minifier setting for css compression and non-blocking javascript as pagespeed suggested.

    Make sure you’re clearing your minifier cache before using pagespeed.

    5. Are you trying to fix position the slider like the navigation? Possible, but will affect your site’s accessibility and readability.

    Thanks!

    #109041

    Liquidator
    Participant

    1. Ok. But now it seems i have a gap between above masthead slider and navbar. Check it out
    2. OK
    3. OK
    4. Worked. thank you.
    5. I’m trying to fix an image on the top of the page (above masthead) just you guyz did for theme.co/x demo. I don’t really need a slider (why would i need a slider for 1 fixed image?). Navbar should stay statis (it’s static atm).
    6. Btw, huge problem: try to open website in Mozilla Firefox. There are plenty of problems.
    7. In Chrome, there’s something wrong with navigation animation. It pushes me to selected content band and then pushes me to top a little. Did you notice that?