Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8213109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:00:00+00:00 2026-06-07T11:00:00+00:00

I have a scroller maked with a plugin called simplyscroll.js in jquery. Inside It

  • 0

I have a scroller maked with a plugin called simplyscroll.js in jquery. Inside It I scroll many images loaded at runtime using a database. I want to apply at every image a fancybox of the image with some text loaded by database:
(The text that I wanto to load is inside $img['txt'])
code:

<ul id="scroller2">
<?php
   $qry_img= $db->query("SELECT * FROM image_prodotti;");
   while( $img = $qry_img->fetch_array() ){
    echo '<li class="new"><a href="img/prodotti/caricati/'.$img['url'].'" class="fancy"><img src="img/prodotti/caricati/'.$img['url'].'" alt="" /></a></li>';
 ?>          
</ul>

<script type="text/javascript">
$(document).ready(function(){
    $("a.fancy").fancybox({
        'transitionIn'  :   'fade',
        'transitionOut' :   'fade',
        'speedIn'       :   600, 
        'speedOut'      :   200, 
        'overlayShow'   :   true
    });
});
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T11:00:01+00:00Added an answer on June 7, 2026 at 11:00 am

    There would be three possible ways to do it :

    First (the easiest and simplest) – Add a title attribute to the <a> tag and set $img['txt'] as its value:

    <ul id="scroller2">
    <?php
       $qry_img= $db->query("SELECT * FROM image_prodotti;");
       while( $img = $qry_img->fetch_array() ){
        echo '<li class="new"><a href="img/prodotti/caricati/'.$img['url'].'" title="'.$img['txt'].'" class="fancy"><img src="img/prodotti/caricati/'.$img['url'].'" alt="" /></a></li>';
     ?>          
    </ul>
    

    You don’t need to do any modification to your script. Notice that with this option, the title will show up as tooltip when you hover the thumbnail.

    Second – Set $img['txt'] as the value of the alt attribute in the thumbnail (<img> tag) :

    <ul id="scroller2">
    <?php
       $qry_img= $db->query("SELECT * FROM image_prodotti;");
       while( $img = $qry_img->fetch_array() ){
        echo '<li class="new"><a href="img/prodotti/caricati/'.$img['url'].'" class="fancy"><img src="img/prodotti/caricati/'.$img['url'].'" alt="'.$img['txt'].'" /></a></li>';
     ?>          
    </ul>
    

    Then add the API option 'titleFromAlt':true to your script :

    $(document).ready(function(){
      $("a.fancy").fancybox({
        'transitionIn'  :   'fade',
        'transitionOut' :   'fade',
        'speedIn'       :   600, 
        'speedOut'      :   200, 
        'overlayShow'   :   true,
        'titleFromAlt'  :   true // NEW
      }); // fancybox
    }); // ready
    

    Third – Depending on the amount of text, you may prefer to store $img['txt'] in a hidden <div> just right after the <a> tag; then set its content as the fancybox title once it is opened :

    <ul id="scroller2">
    <?php
       $qry_img= $db->query("SELECT * FROM image_prodotti;");
       while( $img = $qry_img->fetch_array() ){
        echo '<li class="new"><a href="img/prodotti/caricati/'.$img['url'].'" class="fancy"><img src="img/prodotti/caricati/'.$img['url'].'" alt="" /></a><div style="display: none;">'.$img['txt'].'</div></li>';
     ?>          
    </ul>
    

    Then use this script to fetch the contents of the hidden <div> :

    $(document).ready(function(){
      $("a.fancy").fancybox({
        'transitionIn'  :  'fade',
        'transitionOut' :  'fade',
        'speedIn'       :   600, 
        'speedOut'      :   200, 
        'overlayShow'   :   true,
        'titlePosition' :  'over', // NEW
        'onStart'       :   function(currentArray,currentIndex){
           var obj = currentArray[ currentIndex ];
           this.title = $(obj).next('div').html();
        }
      }); // fancybox
    }); // ready
    

    NOTE : this is for fancybox v1.3.2 +

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have put together an image scroller using jquery, like this function rotateImages(whichHolder, start)
I have been using the jquery appear plugin for some time now, but it
I was able to instantiate a working scroller using jQuery Jcarousel however I need
I have an iPhone application that is supposed to show images inside a UIScrollView.
I am trying to integrate iScroll in my application using javascript-jquery.mobile.iscroll plugin . I
I have an infinite scroller for a product page which works well. For SEO
I have written a news scroller which uses the Prototype and Script.aculo.us libraries to
I have a div. When there is a big text then scroller comes on
I have the following Javascript code. When the page is loaded it is scrolled
I have a problem with a jQuery UI 1.7.2 sortable list in Firefox 3.6,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.