Jump to content

Change navigation text links on hover

Go to solution Solved by tuanphan,

Recommended Posts

Site: https://gracelillianlee.squarespace.com/

My site password is: Tr0pic@l

Hello,

I was wondering if there is a way to change the navigation text when you hover over it, for example:

Nav link one:

Normal state: "ENTER MY WORLD"

On hover state: "HOMEPAGE"

Off hover state: "ENTER MY WORLD"

The active state would stay on "ENTER MY WORLD" (I have styled the active state to make my text bold and italic)

I want to do this for all my navigation text so each one has an alternate text on the hover state:

Nav link two:

Normal state: "CURRENT HAPPENINGS"

On hover state: "EVENTS"

Off hover state: "CURRENT HAPPENINGS"

Nav link three:

Normal state: "WOVEN SCULPTURE"

On hover state: "COMMISSIONS"

Off hover state: "WOVEN SCULPTURE"

Nav link four:

 

Normal state: "BEYOND THE VISIBLE WORLD"

On hover state: "ABOUT ME"

Off hover state: "BEYOND THE VISIBLE WORLD"

Nav link five:

Normal state: "THE JOURNEY"

On hover state: "HISTORY"

Off hover state: "THE JOURNEY"

Nav link six:

Normal state: "REACH FOR THE STARS"

On hover state: "CONTACT"

Off hover state: "REACH FOR THE STARS"

 

I appreciate any suggestions in advance 🙂

Link to comment
  • Replies 2
  • Views 1.2k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • Solution

(Just a test code for first 3 item)

Try adding to Website Tools (under Not Linked) > Code Injection > Footer

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
    // enter my world
    $('div.header-nav-item:nth-child(1) a').hover(function(){
    $(this).text("HOMEPAGE");
}, function(){
    $(this).text("ENTER MY WORLD");
  });
    // current happinings 
    $('div.header-nav-item:nth-child(2) a').hover(function(){
    $(this).text("EVENTS");
}, function(){
    $(this).text("CURRENT HAPPENINGS");
  });
    // woven sculpture 
    $('div.header-nav-item:nth-child(3) a').hover(function(){
    $(this).text("COMMISSIONS");
}, function(){
    $(this).text("WOVEN SCULPTURE");
  });
});
</script>

image.png.4da9a69773c641b2f82babaaedc4712b.png

image.png.3cf433eccb7bb7723e92eaa2fbbcf80c.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.