Colleagues, good day.

There is a bit of a strange task (more even out of interest). There is a site built on the framework yii2.

Imagine the situation. There is a static menu, from it go to page A , divided into 2 parts:

  1. with a list with items.
  2. Here the information is loaded based on what element you click on.

How can I get a link due to which I can immediately go to page A with a specifically selected element and loaded information in block 2?

    2 answers 2

    Depends on the implementation of the menu and reloading on the client. You can use "anchor links" , and if there is a possibility to render the content of all menu items on the server at once, then client scripts will not even be needed and just display the menu with display: fixed , and the content will auto-scroll to an anchor link. The complete solution with reloading involves analyzing the window.location object and then activating AJAX.

      It is obvious only if the client analyzes the URL or any other hints transmitted from the server, after which the AJAX loads the missing part of the page. This is if you want to save the current load logic. You can make the server send both parts entirely. PS Terribly annoying such loadable blocks of text in three lines - would pootvorval hands.