Change start index when the user changes the active image - photoswipe

Does anyone know how to change the start index when the user changes the active image on my website so that PhotoSwipe starts at that image when it is loaded. In other words how I can pass a 'new' index number to PhotoSwipe?

Solved this by using browser history and an onclick event. When they click on a different thumbnail it changes the browser history and PhotoSwipe reads this to zoom the correct image. Example:
onclick="history.replaceState( {} , 'PAGE TITLE HERE', '#foo&gid=1&pid=INDEX' );"
Replace PAGE TITLE HERE with the page title and replace INDEX with the new images index.

Related

Redirect_to a part of a page that is initially collapsed, but with collapsed part opened?

I have a redirect_to and need the user to be placed at the specific anchor (can do that much), but with the collapsed portion of the page already opened up.
I tried
giving an element inside the collapsable portion an id, then redirecting to that id using anchor, but that doesn't open the collapsed portion of the page, so the user doesn't see what they're supposed to, and they may get confused
Running some javascript after the redirect, but it may not be possible
How can this be achieved?
I solved this by using a session variable (e.g. collapse = 'show'), accessing that in the view to append that value to the bootstrap collapse class so it looks like this when it should be collapsed collapse, and it should look like this when it should load the page not collapsed collapse show
This approach could be better if using query params for the action being redirected to (either way will work, but the second method won't clutter the user's session)

SelectMenu Customized and Refresh

I try to develop a selectMenu with image? I take exemple on jquery ui site and modify to add possibility to keep picture visible when you selected item with picture.
Here My code
My problem is on reset. Sometimes I need to put it in initial state.
I try refresh, but there is an automatic add of With on Span result and my select change size. I correct it on create event
widget.css({ 'width': '' });
But don't Work in select event... and when I click on reset my select become smaller.
Then I try destroy event. Good for the size but not for the text display. If I select an item with picture.
Click on reset
When I put break Point :
$(this).children(":first")
return the good item (text=TOUS") But it keeps old selected value to display text and display nothing
I don't know do to refresh correctly my selectmenu and return in first state
If debugging is the art of removing bugs ... then program is the art of creating

One page website: Rewrite URL in address-bar when clicking an anchor-link

I have set up a one-page, horizontal scrolling website with several anchors combined with DIV-id's. The website has five pages side-by-side that automatically render full-page based on the visitors browser-window.
The menu contains seven hyperlinks that address different anchors (div-id's) on the page (for example: http://www.url.com/#partsix). When they are clicked, the visitor will automatically be scrolled to the anchor part of the page. This works fine and really smooth.
The problem i'm dealing with is that, since the page is not being reloaded, the address-bar is not updated. So if a visitor wants to link to a page, or, for example, like the URL with a facebook button, it will be very difficult.
Is there a way to rewrite the address bar with the anchorlink without reloading the page?
EDIT: I have found out that i can user the action onclick="window.location.hash = hash;" on the hyperlinks. This will return the hash of the anchor it is scrolling to in the address bar. Works like a charm. But: my menu plugin does not let me add this action to the hyperlinks. So i wanted to check if i can use javascript to apply this action to all hyperlinks in the same li class. Does anyone know how?
The li class that contains all menu links is 'mc_menu mc_depth_2'

I want to add multiple image at one go by using struts2.0 tag.And if i don't add image in betwwen than it should insert null

I have multiple browse button on the page and if i don't enter image in one browse button it should insert null on that index rather than putting the next image in same tag.
Example:--Suppose there are 3 browse buttons on a page and I enter image for the first and third browse button than the File Array I get on action is of size 2 because it has mapped that third image in the second index.But I want the array should be of same size as there are number of browse button.How could i do this.

JSF2 render retraining old values

I am using JSF2 with #ViewScoped
I have table listing, cliking on row opens record in disabled='true mode'
2- ON the popup in disabled view button called 'Edit'
3- When user clicks upon edit button, all fields on the form which are disabled will become enabled.
Problem is in disabled mode it is fine but when user clicks upon edit button it start displaying few values from old record which was being clicked.
It is not happening every time but randomly when you start clicking.
I am not reloading any data when user clicks upon edit button instead I only make ajax call and set attrib val to true and on the bases of that I render model values and it dispalys enabled values.
is it cache problem or any thing else ???
help required.
In your bean set enableStatus =0;
and in edit button and all of your text fields, set disabled="#{bean.enableStatus==0}"
when u will click on edit then set enableStatus = 1 in your action method and reRender it.
You will get what you want....

Resources