Similar questions, if not exact questions like this have been asked but not often and the answers I have tried to alter with but have had no luck what-so-ever.
Basically, I want to be able to make the content part of my page (so the header remains on each page) change and I'm not sure if this is with anchors using only one html page or if it's multiple html pages or really how it's done at all. Been looking for over 5 hours but to no avail.
I came across this site looking for an answer and it has exactly what I am looking for http://www.aivahthemes.com/themes/gracious/index.html
I looked everywhere and found sites where it did similar things but if you went right by two pages and then went back to the original page, you would see the middle page on the way back. That site above does NOT do this and actually hides the pages between links somehow which is amazing.
This is a bit vague as I havn't posted any code but literally all the code I tried was just from previous questions and it was just me trying to adapt half-answers to what I wanted.
Any help is greatly appreciated, I'm stumped!
Edit:
*Looked a bit more into detail, does look like one whole single HTML page. Why was it so quick to load though if it was an entire page? Thought that would have been a long process.
Edit2:
*Is it also possible to achieve this 'style' by doing it vertically?
The site you listed uses hashes in the URL. You can add them dynamically with javascript or just by using plain anchors. Hash in the url will save it in the browser history and the back/forward buttons will work fine. The only tricky part is reading the hash, which is pretty much straight forward with window.location.hash - it returns everything after '#' sign.
The script for animation/getting pages would be a little bit more complex, but as I see it's all based on getting the right <div id="HASH_FROM_URL">, moving it to 'left: -9999px' and then animating to main container's offsetLeft.
Related
Forgive me if another thread like this exists - I couldn't find the answer to that specific problem.
I'll soon be developing the frontend for a vanilla JS AJAX loaded website, with SPA-like behavior similar to the home slider in this one:
- http://clapat.ro/themes/grenada-wordpress
The methodology I will probably utilize is loading the innerHTML of a container from the targeted sub-template, then pushing the state to the history - pretty standard approach to this, I believe.
Now, the slides containing image background are pretty obvious - all it should take is placing the same image in the target subpage hero section, then animating in on load. The problem might be with the video slides - how to make them continue playing seamlessly during and after the reload? Will such approach force them to start all over from the beginning, as soon as the target page is loaded and placed in the view?
I haven't tried it yet, I thought I'd ask in advance, in order not to get myself stuck up all the way into the incorrect approach :)
Thank You in advance,
Peter
Researching the reference templates for the 100th time, I think I came up with some kind of a solution myself:
if both the homepage and target page had structure like:
<body>
<main-container>
<slider-or-hero-container>
...
</slider...>
<content-container>
...
</content...>
</main-container>
</body>
Then, maybe I could replace the whole "main-container" on normal links, but replace only "content-container" clicking the links within the slider? The slider section would basically just stay, and the script would simply modify its appearance (disabling arrows and slide change, perform the transition animations etc)...
If you had any suggestions at this point, I'll really appreciate that :) Otherwise, I will post an update when I'm done coding it - if it works, it may be helpful for someone in the future :)
Edit: The page code can be found on my page URL. I don't know where the fault might be. Please help.
Problem:
When we click to the chess puzzles page for the first time, they work. However, the boards vanish when we re-click to them from the homepage.
Demo:
This is the home page.
You click on a player's picture and you are taken to this page. Please note that the boards appear in this one.
But you see that link to go back to the puzzle list. You click on that and you land on the home page again.
Now, if you click on any of the players' photo (or even the same player's photo), this is what you get.
From now on, none of the puzzle links would work.
You can check it yourself at chess-puzzle.com.
Few information:
The site used Cloudfare. I tested with Cloudfare (inactive) a few minutes back yet the problem is not resolved.
I validated JS and it seems to be okay.
I have only one CSS file on my own (mycss.css). Other external files came with the piece of software.
I don't know which code to share because I don't know why this might happen. Though I can share any code by editing this question if asked for.
Can anybody please provide an answer to this.
The problem is that you have the attribute async in the scripts (jquery, chessboard) and that means that they do not load in any particular order.
But, the chessboard uses jquery at some points so if the chessboard script loads/runs first it will crash because it does not find jquery.
The script at the bottom will also fail as it might run before jQuery is loaded.
Finally you have included the chessboard script twice in the `head.
The best solution for your case would be to move the scripts at the bottom of the body, right above your inline script and remove the async attribute from them.
I would like to make a smooth scrolling to different parts of my page when clicking on navigation bar.
I have googled this but I found codes that I don't understand, they don't explain where I should put my info, they just throw a long code with no indication of how to adapt it to my case. I would really appreciate some help.
here is my codepen.
`https://codepen.io/aabla/full/aYYOxy`
You have an exemple on this page :
https://css-tricks.com/snippets/jquery/smooth-scrolling/
And everything is explained in comments.. There is simpler ways, but this one is really complete..
If you want to make this work, you have to call jQuery first.
EDIT
Here is your codepen working :
https://codepen.io/anon/pen/EEBOEg
Plus, in yours you had some mistakes on ID attributes (The IDs of the links were not equal to those of the <div> elements), this could not work anyway..
I was trying to fix the width of the images however, unexpectedly, the navigation pager below disappeared.(pages 1,2,3). I am new to CSS and have no idea what happened. I don't now how to fix this, the navigation codes are still present however I guess it cannot find any space to show up. Can you help?
Code:https://gist.github.com/anonymous/3704b07a027426208738
Website:https://www.alphabitrage.com
I went through your code until I counted about 50 coding errors.
So I ran the source code (from the GitHub link you provided) through the W3C Markup Validation Service, which found 565 coding errors.
This alone suggests multiple problems with your web page and potential difficulties ahead in terms of maintenance and troubleshooting.
However, I understand you're working with a template so recommending that you re-structure your code to be valid and semantically correct (which I would normally do) may not be feasible in this case.
Also, you mention in your comments that the code was working well until you made some adjustments to the widths of images. So I put the errors aside and continued searching for a possible problem.
Providing a link to another website with a working template was a good idea on your part. I was able to compare your code with the code from the other site.
I discovered that your code was missing the divs that render the HTML for the pagination links.
In particular:
<div class="blog-pager" id="blog-pager"></div>
... is completely missing from your code.
Your Site
Other Site
Once you restore that code block your pager should re-appear.
Still on the same project.
I currently have a theme I'm working on for tumblr. It's incredibly image heavy, so my goal is to load the entire page one (or a few) times while still being able to go to the next page of posts with pagination. The native pagination requires the entire page to load in order to get to older posts. What I believe I'm trying to achieve is loading with ajax, like this?
(Tumblr also does have an established script similar to this, infinite scrolling, which allows you to load more posts by scrolling to the bottom. That convinces me that this is possible, but unfortunately, as far as I know, not created yet.)
So, can anyone help me, if only it is to point me in the direction of an already established plugin somewhere? I've run into quite the problem since i know very little about scripting and nothing about ajax. I'm still quite new at this!
Again, here is the entire code of the theme currently, if that will help you with your answer. (Obviously, my posts render in the "POSTSGOHERE" div.) And, just in case, here is the script for infinite scrolling that definitely works on tumblr.
(No one point out how I haven't chained all my plugins yet, I'm a little cautious since they currently work and I don't want to break anything!)
Thanks again, stackoverflow.
EDIT: To clarify, I don't want infinite scrolling. I want pagination via ajax, like in the example. Infinite scrolling also will slow down my page, since you can only load so many posts before it just harms the speediness of the theme. It's very cumbersome and messy for this page.
Also, guys, I can't comment on your replies, for some reason? I'll just edit up here in order to reply.