I tried some options mostly if not working I delete it
but what |I try I cant get after page load skip
to the has-id in php or with a javascript
Ow yes I do not known anything about javascript
if I do something it is lucky-shots
It must be something like this
home/read.php?id=833&title=klant-is-koning#494
I saw also many articles about hash but did not saw any
url with .php?id111#111 or something like
Code: Select all
<script>
window.location.hash = hashTag;
window.location=window.location.href;
</script>
Code: Select all
<script>
$(document).ready(function() {
var hash = window.location.hash;
if (hash) {
var elem = document.getElementById(hash.substring(1));
if (elem) {
elem.scrollIntoView();
}
}
});
</script>
This script I saw also what working but not on page load with url but only when page is loaded
Code: Select all
<style>
body {
font: 14px/2 Georgia, serif;
}
#page-wrap {
max-width: 500px;
margin: 1rem auto;
padding: 1rem;
}
h1, h2 {
line-height: 1.2;
}
p, ul, h1 {
margin: 0 0 1rem 0;
}
</style>
<script>
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
&&
location.hostname == this.hostname
) {
// Figure out element to scroll to
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Does a scroll target exist?
if (target.length) {
// Only prevent default if animation is actually gonna happen
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top
}, 1000, function() {
// Callback after animation
// Must change focus!
var $target = $(target);
$target.focus();
if ($target.is(":focus")) { // Checking if the target was focused
return false;
} else {
$target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
$target.focus(); // Set focus again
};
});
}
}
});
</script>
<a name="/#'.$row['comment_id'].'" href="#'.$row['comment_id'].'"><button>skip</button></a>
& this script works but also not after page load with url
Code: Select all
<button onclick="myFunction1()">top</button>
<script>
function myFunction1() {
location.href = "#top";
}
</script>
<a id="top"></a>