Answer the question
In order to leave comments, you need to log in
Music without breaks on the site when switching between pages
Good day to all.
TK was given: to accompany the site with background music on all pages so that it does not break when clicked.
Options: New HTML 5 audio tag
Use script.
The first option led to breaks: you click on a new page and the music starts again. There is no unity.
The second option was more difficult. Personally, I don’t really know java script, so I used a ready-made script, which was found in a simple way by googling. But the music still cut off.
The question is already obvious: How to make a non-cutting background sound? What ideas? Is it possible?
If anyone has experienced this, please share information and resources.
On flash sites, the principle of operation is clear, but with html I don’t understand the principle of action.
Thanks in advance to anyone who can comment on the situation.
Answer the question
In order to leave comments, you need to log in
Implemented this recently. You will need ajax (you can use jquery, you can use pure js) and history api (here I just used pure js).
In short, the algorithm is as follows: the user clicks on the transition to another page of the site, the event is caught and sent to the server via ajax, where the script will give the code of the page to which you want to go. History api should change the address in the address bar of the browser, and if the user presses the back button, then hang an event on it (everything is well described in the article, the link to which I gave above).
In the right way, you need to do PJAX pjax.heroku.com/
This is done on github and it seems like in contact too.
This can't be done with a page reload. Use AJAX technology (example vk.com) or frames, at worst.
Sobsno than to play music in this case - it does not matter. The important thing is that you need to make a transition to another page (or the illusion of a transition) while actually staying on the previous one.
As mentioned above, AJAX/frames and the History API will help you .
The most bug-free option is to make a frame.
In which you can even show the necessary controls.
JS, Ajax and so on will be an extra hassle.
This is not possible directly, because there is no means to control rewind in the browser and the playback of sounds is tied to the DOM model.
As a solution, you can abandon the page model of the project in the direction of FullAjax - there are no transitions between pages, no breaks.
Well, apparently you will have to do AJAX transitions between pages, for this it is best to use the jQuery Java-Script library, I think there will be plenty of plugins for it.
Thank you. All of these things will need to be explored.
But you showed me the direction of movement
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question