I would like to create a more button similar to facebook that loads more items on the wall.
Could someone please advice on how I could get this working in PHP. Could you please point me to a resource or let me know a way how I can acheive this.
I think what you seek is called an infinite scroller.
Check out this tutorial on how to create an infinite scrolling gallery on PHP. This one doesn't have the "more" button, it loads more content automatically every time you scroll the page down to the bottom. But it's easy enough to adapt it to work with a "more" button.
Edit: here's another tutorial, this time with the button.
Related
I want to load more images in my website when I reach the bottom of my page. I'm using php and postgresql as my database.
For this post I simply load some text instead of image. I can write the code for it's equivalent.
So currently, I'm using a button at the bottom of my page, which when pressed re-loads the page and gives you more images(I'm displaying 50 images at a time).
But there are 2 problems with it, one being that the user will have to press the button again and again while I want it to happen automatically.
And the second one being that when new images are loaded, the previous ones are gone. I don't want to happen. For eg., if currently 1-50 images are present, my page later changes it to 51-100 while I want it to have all 1-100. I'm unable to solve this.
Please help. Thanks!
What you are looking for is commonly referred to as "infinite scroll pagination", while what you're asking for is techniclly possible using only PHP it would be a terrible user experience, as each reload would take the user to the top, and they would constantly have to continuously scroll further and further just to reach the location they were previously at.
Alternatively, handle this with JavaScript, an example: https://infinite-scroll.com/demo/full-page.
Doing simple Google searches reveals a plethora of options for JavaScript and JQuery plugins to achieve this.
An alternative, without the need for a plugin you can implement the answer to this:infinite-scroll jquery plugin
Simply call your PHP code in the form of an AJAX request when the bottom of the page is reached and append your new results. (this could be easily achieved with vanilla javascript as well).
Hope this helps.
So I have no idea how to ask this. I have a Website with Posts like Twitter. Currently 8 Posts fit on one page, is it easy to implement that when the users scrolls down, 8 additional Posts are revealed? Or is it way easier to make it with pages? Beginner here :)
Its more user friendly to load more content when user reaches the end of the page or by clicking a "View more" Button. using JavaScript.
Check here on how to use JQuery to make this possible:
https://infinite-scroll.com/
Hi if someone could help I would really grateful. I am using the Woohoo wordpress news theme. What I would like to do is when a user clicks to a post that they can just scroll to the next post as well as the url changing when the next posts is scrolled to. I have struggled to find a suitable plugin. The one I found is called smart scroll which does what is supposed to, which is add infinite scroll and it changes the url when in the single post, seen here (https://wordpress.org/plugins/smart-scroll-posts/). The issues I am having with that is, when I navigate back to the home page all the posts do not display until I refresh the page. Currently I have a standard infinite scroll plugin doing the scrolling but would like to add the url change in as well.
If Someone has come across the issue before and found a fix or even a better way to do this I would be grateful for some help. Thanks
So basically I need something similar that twitter has - when user scrolls down to the bottom of the page, new information from database automatically loads. Any suggestions how to create it or any examples? I know it can be done with AJAX, but could you please show a example, or a sample code?
It is called Infinite Scrolling (or Endless Scrolling). I think the most widespread solution is using Paul Irish's Infinite Scroll jQuery plugin. Also, you can find related information, documentation and demos in the Infinite Scroll page.
I have seen this in many apps where user is first asked to click like button and then redirected to the main app. How can I achieve this?
I am using php.
Adding a like button on top of the app pages doesn't attracts much likes.
Any help is appreciated!
-Sandy
There are so many solution already for this. Basically you just need a javascript script to hide the main page , and a php script to show the page so that until the user cliks like, then you show it.
A simple searching gave alot of code.
check this ones on stack, or this one and also, this one
Basically, you have to use jquery to hide the page
hope this helps!