V
V
vampire4442016-03-01 10:47:49
Gallery
vampire444, 2016-03-01 10:47:49

How to make image view from modal window?

Such a problem. On the main page there is a slider of quotes of posts of a certain category. When you click on a button or title in a Bootstrap modal window, the post itself opens (without reloading the page). There are almost always several photos in the record and you need to organize their beautiful viewing. I tried a bunch of galleries (both plugins and "handles installed" scripts), the result is the same - nothing works. Either the bootstrap crashes and the window does not open at all (at the same time, another half of the page stops working, this happened when installing non-WP plugins), or there are no changes, that is, the pictures simply open in the browser tab, as if there is no plugin.
I've been struggling with this for almost a week, I still couldn't come up with anything.
Here's some more information, in case it helps:
1) a one-page site, with a possible expansion in the future. Those. while it is not supposed to view posts on separate pages, only in modals. The whim of the customer, could not convince.
2) the theme is completely self-written, made on bootstrap (+ jQuery).
3) the content of the post is loaded into the modal like this:

function load_post(ID) {
                $('#post-title').text($('#caption-title-'+ID).text());
                $('#post-content').load("./?p="+ID);
            };

Those. one modal, in which, when you click on a particular link, the content changes.
4) because viewing posts on separate pages is not provided, and if singl.php is accessed, then neither header.php nor footer.php are included in it. Therefore, all add-ons are not connected. scripts and styles. (After all, they are not needed, I decided, since the post opens in a modal window, and everything is already connected in the main window. And why do I need a header and footer of the site itself in the modal. Or is this a jamb? In general, I tried to connect them , but this did not affect the galleries in any way)
In principle, it is not at all necessary that the photo viewing be carried out in another pop-up window. I came up with this one myself:
the first picture from the series is opened immediately large, and under it the rest of the miniatures. The whole thing is switched by arrows and / or by clicking on another photo. It is not difficult to implement even by yourself, but another problem has already appeared - how to make it convenient, for an ordinary person, to add such a thing to a post from the admin panel. I found several plugins with such a function - again nothing works, just pictures in a row.
For clarity, I'm attaching a couple of screenshots
. Here's a post slider:
8ffc7d9fcbb743cb901378246897c3ee.jpg
And the post opens like this. Here, in addition to the text, there will be pictures that need to be beautifully looked at
15729d5856bc4ee38e99438db2a87d15.jpg
. I will be glad for any decision!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nikfakel, 2016-03-01
@vampire444

Perhaps your pictures are loaded and created by a script, the handler is not hung on them and therefore nothing happens. Add an image not in the modal window, but simply in the body of the site, and test how it will open there. If this is the problem, then the usual scripts of modal windows will not work for you, either write it yourself or change the way images are loaded. As an option (if there are not too many posts with pictures), immediately display posts via PHP and make them hidden. In general, it would be better if they gave the address of the site.

N
Ninja Mate, 2016-03-01
@victorzadorozhnyy

I would make the structure like this, the posts themselves are there and displayed on the site, but they are not visible to the user, and we push the single post page into the modal to display the page itself.
But in general, plugins have their own js and css script, right? and on the page they are connected to you? if so, is the required markup for the div in the modal respected.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question