On Nov 25, 3:46 pm, jonnyvegasss <jonnyvega...@yahoo.com> wrote:
> That seems to be exactly what I need. I'm just not sure how, where to
> add something like that. I apologize for my ignorance, but as I said
> I'm learning LOL!

I'm sorry, it looks as though I didn't read your original closely
enough.  I thought you were talking about a true modal window rather
than the prettyPhoto popup.  I looked at the prettyPhoto documentation
(http://tinyurl.com/dkuwya), and buried in the customization tab of
the Setup section is the set of options you can pass into the
prettyPhoto function.  Among these are things like animationSpeed,
padding, and opacity, and one called "callback", which takes a
function to be run when prettyPhoto closes.  (Most similar scripts
have a name that's a bit more descriptive, such as "onClose".)

To use this, you need to pass to the prettyPhoto function an object
with certain properties.

Because I led you astray before, I'm going to explain this in detail.
But first, here's the solution I think you need:

    $(document).ready(function(){
        $("a[rel^='prettyPhoto']").prettyPhoto({
            callback: function() {window.location.reload(true);}
        });
    });

You can see this in action here: http://jsbin.com/uvuwi (code
http://jsbin.com/uvuwi/edit).

========================================

Explanation:

prettyPhoto allows you to supply a number of optional arguments.  They
are wrapped up in a single JavaScript object, which you can create
with this syntax:

    {
        option1: "value1",
        option2: 7,
        anotherOption: ["a", "four", "element", "list"],
        stillAnother: function() {doSomething(); return false;},
        finalOption: false
    }

It's an unordered list of name-value pairs, separated by commas,
surrounded by curly braces, and with a colon between each name and
value.  The values can be strings, numbers, arrays, functions,
booleans, other objects, essentially any JavaScript values.

For prettyPhoto, the options might look like this:

    var myOptions = {
        animationSpeed: 'slow',
        padding: 25,
        opacity: 0.5,
        callback: function(){doSomething();}
    }

Then you could call

    $("selector").prettyPhoto(myOptions);

As the only option we need is the one named "callback", we can simply
do this:

    $("a[rel^='prettyPhoto']").prettyPhoto({
        callback: function() {doSomething();}
    });

And as to the function we call, this is pretty self-descriptive:

    window.location.reload(true);

Putting that together inside a document ready event, we get the code I
supplied above.  I hope that all makes sense.

========================================

> Also, I looked at the links you posted, and I don't see the parent
> window refreshing after the child window is closed.

I was just trying to show how to call a function when a child window
closed.  I didn't actually refresh the page, just ran an alert.

Good luck,

  -- Scott

Reply via email to