I have 30 div rows blocks in a page. Firstly I want to show only 5 rows and when user scrolls to 5th row then start loading next 10 rows. Repeat same till the end of the content.
In case of delay in content loading then show "Loading more products.... ".
This is called "lazy load". You can search for it to see how you can implement it to your project.
Here one jQuery plugin for such as things
http://www.appelsiini.net/projects/lazyload
Related
I'm having 3 options
1- show footer on all pages
2- show the footer on the first page only
3- show the footer on the last page only
I'm done with this part if we select 1st option its shows the footer perfectly on the first page but it's taking space on other pages as well. it should be not like this if we select to show the footer only first page it should not take up space on the second page and other pages.
same as it is if we select the 2nd option to show the footer on the last page only. it is showing perfectly on the last page only but it's taking space on the first page and other pages as well.
Does anyone have a solution?
In pagination posts (articles that are split into several pages by using the page-break), I want the next page of the article to automatically load when a user scrolls down in the article, rather than the need for the user to click the "next" button in order to move to the next page. Here are some examples of that:
https://constative.com/lifestyle/funny-fathers-trying-to-master-parenthood-is/
https://www.bleacherbreaker.com/trending/photos-that-people-shouldve-looked-at-a-little-longer-before-posting/
Any idea how I can do so on a WordPress site? Any plugin? Code?
Here is how to implement an Infinite Scroll in wordpress:
https://www.wpbeginner.com/plugins/how-to-add-infinite-scroll-to-your-wordpress-blog/
I have used Swiper in my views to create a slide of contents, and have a views content pane which brings 4 items at a time sorted randomly.
A random sort works with a page refresh but i want this view to get updated without page refresh when a user changes the slide in content section.
I have tried JQuery Ajax Load module but it doesn't support views.
Any suggestions will be appreciated.
thanks
If you know what ajax is expecting exactly you can make the script on your own and provide that data. Start from empty php file, add drupal's bootstrap code at start:
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
And after that drupal is fully functional. Use views, load nodes or what ever you need. Format output as it's needed, print it out...
I have few links(anchor tags) which comes in a div dynamically. If those links goes above 10 in number, I want only first ten to display on page1 and remaining on page2 and so on.
Any help ?
Thanks.
What you're asking for is a technique called paging. This means that as you said, when the number of items would go beyond a specified limit, only a subset of items would be shown.
To have paging, you need to have these items:
Total items count
Items count in each page
Current page number
Some navigation button for navigation between pages
The overall procedure would be something like this:
When page loads, you should count all the links you have, then you should decide how many links you're going to show on each page (say you have 376 links and you want to show 10 links per page)
You count how many pages you would have (a simple division of total-items/page-items, but you should take the ceiling, in order not to lose your last page)
Then you should see which page user has requested (this is your job, and usually occurs in passing parameters via HTTP AJAX request)
Now to show items of that page, you simply should skip the items in previous page, then take 10 items and render them.
I have a working version of my code here:
http://jsfiddle.net/5Hqs3/24/
As you can see, there is a default message that displays upon arrival. After a few moments, the cycle begins and "Billing Reminders" becomes bold and a billing message is displayed, then Collections, then Payments.
If you hover over one of the links, it displays that message. Works great.
However, I now need to add multiple messages per category so that the active link remains bold, but the 1st message fades away and a 2nd is displayed. Or a 3rd, and so on.
You'll see in the jsfiddle that I've got divs for the second message within each category that I need the jQuery to cycle through regularly, or when the user hovers over that link.
Any thoughts?
Take a look into the jquery Cycle plugin. This will cycle through a set of tagged elements. So on select/hover you can trigger a cycle element to start playing. There are a host of options available like before/after/onend, etc. So on hover of one of your divs you could trigger a cycle object to start playing. On mouseout you stop the cycle.