Okay
  Public Ticket #351831
Salient anchor tag to a new page
Closed

Comments

  • Ryan started the conversation

    Hi, very simple problem. I want to make a link on my homepage that takes to me another page, and down to the anchored item. I tried this: http://mysite.com/page#test and when I publish the page the link becomes this: http://mysite.com/#test and won't link to the page. HELP



  •  8,847
    Tahir replied

    Hey!

    This is a known bug and will be fixed in a update coming out this week. If you want to make the edits. 

    You can edit the init.js file on your server, kindly open that and change this:

    $("#header-outer a[href*='" + location.pathname + "']").each(function(){
    	var $href = $(this).attr('href');
    	if($href.indexOf("#") != -1) {
    		$(this).attr('href',$href.substr($href.indexOf("#")));
    		$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
    	}
    });
    

    to this:

    if(location.pathname.length > 1) {
    $("#header-outer a[href*='" + location.pathname + "']").each(function(){
    	var $href = $(this).attr('href');
    	if($href.indexOf("#") != -1) {
    		$(this).attr('href',$href.substr($href.indexOf("#")));
    		$(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
    	}
    });
    }
    

    Thanks 


    ThemeNectar Support Team 

  • Ryan replied

    I found that file in the theme/js folder, but did not see that code. Maybe it's the wrong file?

  •  8,847
    Tahir replied

    Hey Ryan!

    Are you running theme version 5.0 ?. If not please update. 

    Thanks 


    ThemeNectar Support Team 

  • [deleted] replied

    Hey Tahir,

    I seem to be having the same issue.  i am running 4.9.  When i installed 5.0 it broke the site.  Im using alot of the visualizer to build the pages so my client can easily edit.  But when i update to 5.0 it makes all the pages as if they are blog pages and turns all the full width stuff into boxed almost.  SO i reverted back to 4.9 and added the init.js from 5.0 which does fix the anchor issue but then nothing else loads on my site.

    the 5.0 init.js works fine with 4.9 but when i add the line the site breaks again.  Am i doing something wrong with the upgrade? i really hope i dont have to rebuild all of the pages only to use anchor tags.

    if(location.pathname.length > 1) {
  •  8,847
    Tahir replied

    Hey Antoine!

    See screenshot: http://prntscr.com/5vkf3o . You need to add the ending curly brace as well. 

    Thanks 


    ThemeNectar Support Team 

  • [deleted] replied

    Thanks that was the issue.  thats why i dont mess with javascript.

  •  8,847
    Tahir replied

    Cheers 


    ThemeNectar Support Team