Go top button only works on Homepage - html

Here my site: viettech-ca. com
My codes:
<div class="wrap footer-nav mgt35">
<ul>
<li>Về chúng tôi</li>
<li>Đại lý</li>
<li>Liên hệ</li>
<li>Điều kiện & Điều khoản</li>
<!-- <li>--><!--</li>--></ul>
<div><a class="go-top" href="#">Lên đầu trang</a></div>
</div>
go-top works, but it redirected me to the top of the homepage instead of the top of the current page.. Please show problem

since you also have javascript:
JS:
function scroll2Top(){
scroll(0,0);
}
HTML
<a class="go-top" onclick="scroll2Top();return false;">Lên đầu trang</a>

I'm assuming you want to set up a 'Go to top' link in your page that takes the user back to the top of the page.
You do this with anchor tags where you would usually define it at the top of your code and then reference to it when required.
Code at top of html:
<body>
<a name="top"></a>
...
Then your 'href' link would be as follows:
<div><a class="go-top" href="#top">Lên đầu trang</a></div>
If you leave out the top anchor name (name="top") it will still work, but this is bad practice because whats happening is that the page can't find the '#top' reference, it scrolls to the top anyway but because is can't find the link.

Related

Anchor <a> tags are not working in slider

There is a slider at the top of the page.
Each slide has a layer of list and anchor tags with image tag inside.
https://www.rakuten.ne.jp/gold/yanosp-fineplay/
Here is the HTML code for the slider part.
<div class="slider">
<ul class="bxslider">
<li>
<img alt="ランデイズパック リュック" src="sliderimg/rundaysslider.jpg" />
</li>
<li>
<img alt="" src="sliderimg/porchn.jpg" />
</li>
<li>
<img alt="" src="sliderimg/slider13.jpg" />
</li>
</ul>
</div>
As you can see, each anochor tag has target="_blank" and it's supposed to open a new tab for a new page. However, clicking won't open the link, let alone a new tab. I was wondering if this has something to do with z-index or something, but what's weird is that, if you go ahead and hover each image in slider, the link still appears. I just can't figure out why this is happening, and any helps would be greatly appreciated.
Thank you so much.
PS - I do not think this has something to do with bxslider plugin, so please refrain from just commenting something like "Try other slider js"
I think this is how the bxslider.js plugin works,
When you click, the action is working on the bxslider.js plugin slidering instead of clicking the link.
but when you alread slider to other picture, the clicking anchor action is working. try it!
sorry for poor english.

href link working for one item but not for another

I have an index.html that includes:
<li>
<a href="imprint.html#imprint-link">
<div class="main-menu-title">IMPRINT</div>
</a>
</li>
When I click on this item another html file (imprint.html) is loaded, but when I click on Home, which includes the following code to go back to index.html, it doesn't work!
<a href="#index-link">
<div class="main-menu-title">HOME</div>
</a>
What is wrong here?
Update 1: When hovering the mouse over the link I get:
try using this code :
<a href="index.html">
<div class="main-menu-title">HOME</div>
</a>
inplace of :
<a href="#index-link">
<div class="main-menu-title">HOME</div>
</a>
To answer your original question.
What's wrong here?
As a couple kind folks already commented and one person already provided a nice solution, clicking on your original link
href="#index-link"
while you are on the imprint.html page will not take you to your index.html page. Why? Because
<a href="#index-link">
<div class="main-menu-title">HOME</div>
</a>
is saying, "Take me to an element on the current page (imprint.html) that has an ID of 'index-link'. If there is no element with and ID set to index-link, on the imprint.html page, nothing will happen. And, you will stay on the current page because you didn't specify an URL outside of the current page, which is still imprint.html.
So, with that current setup, you will not get to see index.html.

On click open id anchor inside dropdown menu on another page

I'm trying to create a link to an id tag wich is inside a dropdown menu and is placed on another page.
<a href=index.html#test>link to id tag on another page</a>
The problem is when I click the link it goes to the right page but not shows the content because it is inside a collapsed dropdown bootstrap menu
<ul class="dropdown-menu">
<li><a class="chapter" href="01-primaria.html">
<div class="img-menu">
<img class="img-responsive" src="img/01-primaria.png">
</div>
<div class="titleChapter test">
<strong>01.</strong>
<br>
Vuestro hijo está en Educación Primaria
<small>Victoria Urzáiz Celigueta</small>
</div>
</a></li>
</ul>
I need to deploy the right menu when the link is clicked (I will have more than one menu).
Any clue?
Thanks!
Try calling a JS function that displays the intended page inside an iframe or a division when the items from the drop down list are chosen.
Eg: JS Function
function loadPage(){
document.getElementById("divisionID").innerHTML='<object type="text/html" data="01-primaria.html" ></object>';
}
HTML Page:
Create a division of the above name and leave it empty. So when your list item is clicked(onclick()) or when the selected item is changed (onchange()) call the JS function instead of referring to the page itself.
<li><a class="chapter" onchange="loadPage()">
Hope this helps

web page navigation not working when link is clicked

I have a web page that is a table of contents and the page navigation is not working. Here is the html:
<a name="top_of_page">Create Account</a>
top
When i click on the top of page link nothing happens. Am i doing something wrong? Thanks for any help in advance.
name is not the correct attribute to use. Use id instead.
<a id="top_of_page">Create Account</a>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
top

HTML local anchor doesn't work, web page is not reloaded

Greeting,
I am trying to use local anchor in a web page, but it doesn't work. The local anchor's URL like this:
https://hostname:port/info?newElement=true#a
If I use this URL to load the web page directly, I can see the web page is located in the correct position where the local anchor is. But if I click the hyper link in the web page, nothing happens, though I can see the URL is correct in the footer when I hover mouse on the hyper link.
The web page is not reloaded and the URL in the browser's address box is not changed to the URL with "#a" at end. Is it due to the web page is an active web page?
Below is the code sample:
"form.jsp":
<div>
<div>
<jsp:include page="form-nav.jsp" />
<div>
<jsp:include page="form-location.jsp" />
....
</div>
</div>
</div>
"form-nav.jsp":
<div>
<ul class="tab">
<li>
Name
</li>
....
</ul>
<div>
"form-location.jsp":
<div id="location" class="page">
...
</div>
Thanks,
Zhe
DEMO
Here is an example of how to use the anchor tag.
Anchor syntax:
Link text
Referenced Element:
<div id="someid">You content goes in here</div>
everyone,
by further codes reading, I found the problem now. There is a override of the hyper link's click behavior in a js file:
$("body..... ul.tab li a").on('click', function() {
...
return false;
})
By deleting this override logic, the local anchor works well now. Thanks a lot for your comments!