Multiple choice questions in pdf.js? [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to be able to ask the pdf viewer a multiple choice question when he visits page X.
Can someone please give me a high level of how that can be achieved using pdf.js library (or other library)?
I am thinking there should be a way where my front-end detects that user now scrolled to page X and thus executes the javascript function to ask the question. Am I on the right track?
I will further build on your reply. I have done my homework before posting here.

Use .scrollTop() (jQuery) to see how far a user has scrolled through a page:
$(document).scroll(function(){
if ($('.pageX').scrollTop() > 0) {
/*JavaScript to be executed*/
}
});
I have given page X a class of pageX, and the instance that page X fills up the entire window your JavaScript will start.
.scrollTop() looks for how many pixels of the element are above the page (out of site), so if you wanted your functions to begin before the window is filled with page X you can change the 0 to a negative number, eg. if ($('.pageX').scrollTop() > -70) will start your javascript when page X is filling up most of the window.

Related

How to let users upload or change the uploaded images in one page, and display it in another page? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 months ago.
Improve this question
How to let user upload image in one page, and then display it in another page? User can change the image and it'll be changed also in the other page. Also, I'm talking about using php / js / jquery / mysqli anything that's most efficient. (I'm just a beginner in this field so it'll be appreciated if you use some simple language :))
Edit: Yes I said that I'm a beginner, but that doesn't mean I don't know a thing about coding. Also, I saw a few solutions from youtube & other stackoverflows questions, but all of them is about either uploading and displaying in the same page or not being able to change the image.
Format the image into Base64 string
store it in local-storage
In another page get it from local-storage and assign to the id or class.
Suggesting the link that already have answered for
How to save an image to localStorage and display it on the next page?

How can I register how many times a 'user' visits a website? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'd like parts of my website to be non-visible to the user if the user has accessed the website more than a certain number of times. The NY Times website has similar functionality.
I use react & firebase.
I did think about getting a user's IP address but my understanding is that measures geography, not necessarily a device.
P.S. If this question's unsuitable for SO, would you mind suggesting another forum, if you know of one, where it'd be more suitable?
You can use js and the local storage of the client browser to do that the easy way (but it can be easily cheated on by cleaning history).
Just copy/past that in an .html file and it will work if you refresh more then 4 times :
<script>
var dontDisplayPage = false;
if (localStorage.getItem('numberViews') === null){
localStorage.setItem('numberViews', 1);
} else {
localStorage.setItem('numberViews', parseInt(localStorage.getItem('numberViews'), 10) + 1);
}
if(parseInt(localStorage.getItem('numberViews'), 10)>4){
dontDisplayPage = true;
}
if(dontDisplayPage) alert('too many views !');
</script>
Then looking at dontDisplayPage you know if you must display the page, here dontDisplayPage is true if page has been seen more 4 times.
Based on that you can hide the div containing the article for exemple and display a message.

Small tiles that get bigger when clicked [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to create a webpage with several small tiles that enlarge when clicked (And show more/different content, but that's not a part of this question).
This is what I have now: http://puu.sh/nX929.png
When I click on the first tile, it looks exactly like I want it to: http://puu.sh/nX9l9.png
But when I click the second tile it looks like this: http://puu.sh/nX95G.png (gap on the left)
That's not what I want, I want to other (small) tiles to float around it. To fill the empty space.
The source code (+ live example) can be found here (but I wouldn't mind doing it in a completely different way): https://www.crescendosassenheim.nl/Hugo/Training/
I don't even know what to Google, because I have absolutely no idea what kind of technique I can use to achieve what I want. Any suggestions?
http://masonry.desandro.com/methods.html Take a look at this I am sure this will help you, what you want is even displayed at the bottom of the page i am linking.
Download masonry in your computer link to it and follow the little guide in their website.

Load more when scroll to bottom like facebook(Jsp or Servlets) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Yes, I want something like Facebook post. But i'm unable to find any good resources for Java.
I'm making my project using Servlets and Jsp technologies. It has lots of contents in Database. I'm fetching it using Select *.. But i want to put something like Facebook for Loading more contents when scroll to bottom.
Problem is that i don't know anything about Ajax, So please how to implement it on my servlets project during fetching the data, At least give me an ideas.
HELP WOULD BE APPRECIATED!!
Regardless of technology/language, your process goes something like:
1) Request x records from service and display
2) When user reaches end of x records, fetch x more records from web service with offset = x
3) Display those records
Repeat.

SEO - duplicate content with Javascript slide deck [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I have a slider which works like this:
When sliding to an item the URL changes using the HTML5 History API
If a user enters an item's URL (e.g. "/slide-5") directly the slider shows the respective slide.
The navigation of the slider consists of <a>-elements with their respective href-attribute (e.g. href="slide-5").
This works fine and even with JavaScript disabled the user can see every slide's content.
My question is: A search engine is going to crawl all links. But basically all this URLs are have the same content. Can this have negative effect on the page rank? And if so, what would be the best solution to this problem?
If this indeed effects the page rank, would this be a valid solution:
Only the requested slide's content is on the page.
The content of the next requested slide is loaded via XHR.
For current visitors: This post from 2012 is very old now. At this time the History API didn't have a good browser support and it wasn't really clear how search engine handle JavaScript. This has changed drastically in the last years and you can find sources to cover the topic at hand. Still, this is very opinion based.
It might affect your SEO.. It might not. But to be sure; have a look at Canonicalization.
http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139066#2

Categories