Html Anchor
When clicking an anchor you can adjust the position so it does not get cut off by the screen or is too low
Go to Top
Controller Action
function anchor(){
$this->set('codeBlocks_title', 'Html Anchor');
$this->set('codeBlocks_subTitle', 'When clicking an anchor you can adjust the position so it does not get cut off by the screen or is too low ');
$this->set('codeBlocks_renderFiles', [
'View' => APP . '../templates/CodeBlocks/anchor.php'
]);
$this->set('codeBlocks_renderVar', [
'Controller Action' => SetupCase::extractFunction(\App\Controller\CodeBlocksController::class, 'anchor')
]);
View
<style>
a.anchor {
display: block;
position: relative;
top: -100px;
visibility: hidden;
}
</style>
<a class="anchor" id="top"></a>
<a href="#top">Go to Top</a>