Ask questions and get good answers on jQuery

Is it possible to load another gallery from another page into the main page?

Using your example:

 <div class="btn"  onclick="$('#g1').mbGallery({maskBgnd:'#ccc', maskOpacity:.9, containment:'galleryPlace'});"><img class="imgThumb" src="gallery1/LR/04.jpg"><br/>Home</div>

using "onclick" can one target the #g1 div on another page to load?

 <div class="btn"  onclick="$('other_page.html/#g1').mbGallery({maskBgnd:'#ccc', maskOpacity:.9, containment:'galleryPlace'});"><img class="imgThumb" src="gallery1/LR/04.jpg"><br/>Home</div>

Mike

asked Mar 15 '10 at 01:09

DrMikey's gravatar image

DrMikey
232


Mat is right; loading contents cross pages needs an Ajax call (if those pages are on the same domain; otherwise things are more complex) and mb.gallery doesn't support it yet. To do that you should init the gallery after placing your content in the gallery container with your custom function. I'm going to publish soon mb.gallery 2.0 with the capability of loading Flickr sets from any public Flickr account; but this will not solve your problem.

answered Mar 18 '10 at 09:22

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129

OK, in that case the mb.Gallery component does not support that, customization would be required.

answered Mar 17 '10 at 10:07

Mat's gravatar image

Mat
5517

DrMikey,

If you're referring to to the mb.Gallery, the #g1 is a reference to the that you want to apply the mb.Gallery component to, so no, it's not done in this manner.

Having said that, it appears as though you can achieve the outcome that you want by including your links in the <div> elements, not the onClick code.

Like so:

<div id="g1">
    <img src="LR/01.jpg" alt="" />
    <img src="HR/01.jpg" alt="" />
    <div>Entrance view of the SESC Avenida Paulista, São Paulo, Brazil (Photo by Noah Stolz)</div>
    <img src="LR/02.jpg" alt="" />
    <img src="HR/02.jpg" alt="" />
    <div>Fórum Discussões Collaterais - Collateral Talks</div>
    <img src="LR/04.jpg" alt="" />
    <img src="HR/04.jpg" alt="" />
    <div>Runa Islam, "Turn (Gaze of Orpheus)"</div>
</div>

See http://pupunzi.open-lab.com/mb-jquery-components/mb-gallery/

answered Mar 16 '10 at 21:33

Mat's gravatar image

Mat
5517

Thanks, but I am not actually asking about linking to specific images in another location. I am interested in loading the #g1 div within another page containing these images ( as mb-gallery does) into the containment div specified in the javascript, in this case, containment:'galleryPlace'. So I want my onclick event to load this div into the containment div as it does now but load it from another page. I guess, an ajax call.

(Mar 17 '10 at 02:16) DrMikey
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

Asked: Mar 15 '10 at 01:09

Seen: 277 times

Last updated: Mar 18 '10 at 09:22

Related questions

jQuery main site - Matteo Bicocchi