jQuery Javascript: TopUP

Posted on 2009-12-17
Last Modified: 2012-05-08

i'm using the TopUp Javascript library for my image gallery. I have been following the documents, and looking at the Demo.

I am having a hard time figuring out how the "onclose" event/function works. Everything else works perfectly.

I have the following <a href="photos/1.jpg" toptions="effect = clip, shaded = 1, onclose = function() {alert('Hello world!');} "><img src="thumbnails/1.jpg"/></a>

But i can't get the "onclose" to work, such as in this demo:

Thank you so much if you can assist me on this one.

Question by:TikkTakk-Aicon
    LVL 82

    Expert Comment

    I've never used that library, but have you tried specifying the name of the function:
    function closer(){
    alert('Hello world!');
    <a href="photos/1.jpg" toptions="effect = clip, shaded = 1, onclose ='closer' "><img src="thumbnails/1.jpg"/></a>

    Open in new window

    LVL 82

    Expert Comment

    if that still doesn't work, try without apostrophes around the function name:
    toptions="effect = clip, shaded = 1, onclose =closer "

    Author Comment


    I tried them all, still not working... Any further Suggestions?.

    I appreciate your help..
    LVL 82

    Accepted Solution

    this works:
        <script type="text/javascript" src=""></script>
        <div id="examples">
          <a href=""><img src=""/></a>
          <a href=""><img src=""/></a>
          <a href=""><img alt="At Sunset" src=""/></a>
       <script type="text/javascript">
            "#examples a": {
              title: "Gallery {alt} ({current} of {total})",
              group: "examples",
              readAltText: 1,
              shaded: 1,

    Open in new window


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now