Image gallery that refreshes page - javascript

I want to build or find a image slider/gallery that will refresh the page whenever the next button is clicked (to increase page views/impressions). I know that it is possible to refresh the page on click with JavaScript or Jquery but the problem is that the JavaScript is reset and begins at the first slide. I read that it may be possible to achieve this by storing the active slide variable in a cookie. Does anyone know of a gallery that does this? or something similar that I could reference? or any other way I can achieve the desired result?

I think you just need to add this function to your next button (when clicked):
location.reload();
Hope it solved the problem, best regards :)
EDIT: Sorry, yes it does reset the slide. What if you create an HTML gallery? you won't have any problem, and I find it easier / quickier... Sorry for not solving your problem...

Related

Multiple buttons function to expand and hide div section with javascript

Hope everyone is having fun on this fun (or frustrating šŸ˜‚ like me) coding day. So, I came across a problem and was hoping someone could help guide me to the right solution. I want to set it so that when I click on the ā€œread moreā€ button, it adds the ā€œactiveā€ class and would expand the paragraphs.
I was able to do a loop function for multiple buttons on the page, but when I click on one, it affects all the buttons. I know this is a looping problem but I have not figured out a way to solve it.
What Iā€™m trying to do is basically only have the button I click on add the class, without it working on all the buttons on the webpage. I intend to add more buttons to the page, so if anyone has a better solution or knows of a looping method (cause Iā€™m pretty sure the looping Iā€™m using is the wrong way), please help.
Please see the video for what I mean when I click on one button, both buttons get affected by it.

How to create a page location in browser using javascript/jQuery?

I have a setup where I display a list of buttons and clicking on the buttons triggers a function that contacts a firebase database and gets the contents of a 'slide' that is to be shown to the user. The function then clears the content of the page and then creates elements from the data acquired from the database.
Now obviously, when I press back browser button once I've replaced the content, it won't take me back to the previous content. But I believe that my user's experience will be much better if it actually took them back to the list of buttons. I have two faint ideas on how to go about solving this problem but I'm lacking in specific details of how I can go about it.
Possible Solution 1:
Some way to dynamically create a new page using javascript and then serve it to the user.
Possible Solution 2:
Some way to simulate that the page has changed location. Maybe using anchoring links.
Let me know if you have any other solutions in mind or if you know how I should go about implementing these. Your help will be much appreciated. :D

Creating a modal previous and next interaction for images

I am having trouble adding a functioning previous and next button to my modal windows to allow users to navigate through my images without clicking the X and finding the next image. Here is my website link to see and how everything is set out. http://monospaced.co.uk/
I have been struggling for months, my last test I managed to get the previous and next buttons, but they were sitting on the main page when i need them inside of the modal window for each image, and it wouldn't switch. Thanks, for taking the time to help. (if anyone does!)
I am a designer so while it's probably simple to create a previous and next button for your images inside a modal window, I am not sure how to do it without starting from scratch as I wouldn't understand what to change in my code without breaking the website.
Sorry I couldn't get the code into the question. I would really appreciate help, but I understand If it's too much effort because my question is trash...

I need users to proceed to the next page on mouseover in javascript with turn.js

I'm having a problem with the turn.js api.
Rather than using this for a book, I'm trying to use it for an ad I'm developing. Basically, I want to have the first page immediately 'uncover' the second page when the user hovers over the page, but can pull from the corner on page 2 (as normal) to go back to the first.
I'm thinking that I could set a function of onmouseover to mousedown or something like that. Or maybe something totally different.
Any help would be appreciated. Thanks.

Rails Displaying Recommendations - Facebook/Linkedin style

I'm writing a Rails 3.2.1 app and I would like to display suggested items to a user in the following way:
Currently, I have an array of suggested items, and I want to display 5 suggestions at a time. I would like the user to be able to
click on the item to link to something.
click on the close button (and "X") to
if the user rejects the recommendation by clicking on the close button, we display
another suggestion in the same place on the list of 5 displayed suggestions. So the a new suggestion takes the place of the rejected one.
Any ideas on how I can do it? I have tried searching on the web but I can't seem to find a useful direction. Any help would be much appreciated!
Well, you could 'store' the decision of the user in session/cookie/database depending on how persistent you want the decision to be.
After the user rejects a suggestion you could just reload the suggestions taking the decision into account.
E.g.
Suggestions.where(["id NOT IN (?)", User.rejected_suggestions])
(Assuming you have an m-to-n-relation between User and Suggestions called rejected_suggestions)
And the way it is displayed is just javascript.
You could use for example jQuery and fade the rejected suggestion into hiding and let the new one slide in.
http://api.jquery.com/fadeOut/
http://api.jquery.com/slideDown/
And for reloading and storing the decision just use an ajax call.
Alternatively:
Load a few more suggestions (than 5) and only use JS to fade them out and slide new ones into the view - and when all suggestions have been rejected just display something like: 'We are sorry, there are no suggestions for you at the moment.'

Categories