Domanda

I want something like when you click on image on facebook, url changes to facebook.com/photo.php?.... but without redirect. I want exactly the same thing but to open the messages, not photos. Simply, i want when user clicks on displayed messages with other users to open a new popup window without redirecting to new page with all messages with that user. Is that possible and if it is please tell me how to do that.

Example:
Messages with user A
Messages with user B
Messages with user C

And when user clicks on 'Messages with user B', it will open new popup window with all messages with that user, and of course, pulled from database.

È stato utile?

Soluzione

I decided to write this as an answer since it is too long for a comment.

To "properly" set up what you want, you need several parts working together:

  • AJAX: (eg: jQuery.ajax) Retrieve data from the server programmatically with javascript
  • CSS/HTML dialog: (eg: jQueryUI dialog) Create a fake popup inside your page, usually to give the content some prominence
  • History State: (eg: SO Q/A) Change the page URL (in addressbar) without reloading the page.

Altri suggerimenti

I think I understand what you are looking for!

Use case scenario:

1- User looks at a feed of posts/images/anything. 2- User clicks on one of those posts and, it opens in a box with that same content.

The thing you are looking for is called "Lightbox" or "FancyBox".

I googled and found a few examples: http://fancyapps.com/fancybox/ http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/

http://lokeshdhakar.com/projects/lightbox/

you basically need to recreate the loop or make on a onclick function when user chooses the photo, and just call the index of that photo again inside the lightbox.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top