Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Creating buttons that link to different pages


skabir91

Question

Posted (edited)

Site URL: https://shuvamkabir.net

I'm trying to add buttons that link to other pages on my website, using jquery and

$('.button').click(function() {
   window.location.href = "https://www.shuvamkabir.net/someotherpage";}) 

However, the links don't appear to work. Clicking does nothing. I'm not sure what I'm doing wrong here. I've included the code for the buttons that I'm using.

<style>
/**/
/*Main Navigation Buttons*/
/**/
.navbuttonsection{
    /*text-align: right;*/
    /*display:none;border-radius:6px;*/
    width:350px;
    /*height:300px;margin:auto;box-sizing:border-box;padding-bottom:35px;*/
    /*z-index: 1;*/
    position: absolute;
    right: 0%;
    /*margin-right: -80px;*/ 
    /*bottom: 25px*/
  }
  .button-nav{
    text-transform:uppercase;
    text-align: right;
    font-size:1.1em;
    letter-spacing:.2em;
    box-sizing:border-box;
    vertical-align:middle;
    width:350px;
    height:50px;
    opacity: 0.5;
    transition: opacity .6s ease-in-out, width .6s ease-in-out, right .6s ease-in-out, left .6s ease-in-out, letter-spacing .6s ease-in-out;   
    border-top-left-radius:10px;
    border-bottom-left-radius:10px;
    border-top-right-radius:10px;
    border-bottom-right-radius:10px;
    background-color: white;
    color: black
  }
  .button-nav:hover{
    opacity: 0.8;
    width:100%;
    left: 10%;
    letter-spacing: .3em;
  }
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
/**/
/*Navigation button functionality*/
/**/
/*$('.button-nav').click(function() {
   window.location = "https://www.shuvamkabir.net/" + this.id;
});*/
$('.button-Experience').click(function() {
   window.location.href = "https://www.shuvamkabir.net/experience"
});
$('.button-Portfolio').click(function() {
   window.location.href = "https://www.shuvamkabir.net/portfolio";
});
$('.button-CV').click(function() {
   window.location.href = "https://www.shuvamkabir.net/pageCV";
});
$('.button-Services').click(function() {
   window.location.href = "https://www.shuvamkabir.net/services";
});
</script>

 

Edited by skabir91
Link to post
  • Answers 1
  • Created
  • Last Reply

Top Posters For This Question

Popular Days

Top Posters For This Question

1 answer to this question

Recommended Posts

  • 0
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
jQuery(document).ready(function($) {
      /**/
  /*Navigation button functionality*/
  /**/
  /*$('.button-nav').click(function() {
     window.location = "https://www.shuvamkabir.net/" + this.id;
  });*/
  $('.button-Experience').click(function() {
     window.location.href = "https://www.shuvamkabir.net/experience"
  });
  $('.button-Portfolio').click(function() {
     window.location.href = "https://www.shuvamkabir.net/portfolio";
  });
  $('.button-CV').click(function() {
     window.location.href = "https://www.shuvamkabir.net/pageCV";
  });
  $('.button-Services').click(function() {
     window.location.href = "https://www.shuvamkabir.net/services";
  });
});
</script>

 

You can send your question to my email to get detail answer. / How to Setup Password & Share URL 

-- I came back. Will answer soon.

Link to post

Create an account or sign in to comment

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


×
×
  • Create New...