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

  • SEARCH
  • Home
  • 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 8234487
In Process

The Archive Base Latest Questions

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

I have a page which includes details of the registered users. Every html table

  • 0

I have a page which includes details of the registered users.
Every html table includes 80-90 users.
For every user there is a $username variable.
I normally show their pictures in a table like the code below.

print "<a href=\"small-avatar-$username.jpg\" target=\"_blank\">
<img src=\"big-avatar-$username.jpg\">
</a>";

But the user can open images in a new tab. I want to show big avatars easily.
My first choice was lightbox-jquery. But because i use twitter-bootstrap in my site, i decided to use default bootstrap and jquery features.

I saw that there is “bootstrap-modals”. When user clicks link, i don’t plan to show anything more than i big picture.

I tried this:

print "<a href=\"#$username" data-toggle=\"modal\" class=\"img-modal\" >
        <img src=\"small-avatar-$username.jpg\" ></a>";
print '</td>';

.

print "<div id=\"$username\" class=\"modal\">";
       <img src=\"big-avatar-$username.jpg\">
print "</div>";

.

<script type="text/javascript" id="js">
        $('#username').modal();
</script>

I suppose putting $('#username').modal();
for every user to my page will make HTML file huge.

But then I tried class name of anchor like this: $('.img-modal').modal();
But this didn’t work.

What would you recommend in this situation?

  • 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-07T18:29:51+00:00Added an answer on June 7, 2026 at 6:29 pm

    I would recommend you to use a HTML5 Custom Data Attributes in your <a> tag to identify the username and keep your img-modal class.

    "<a href="#myModal" data-username='".$username."' class="img-modal">...
    

    Trigger the call to modal on click on .img-modal (you don’t need the data-toggle=”modal”)

    $('.img-modal').click(function(event) {
    

    You can get the value of the username by using

    var username = $(this).attr('data-username')
    

    Since you have the username you can replace the src property of your <img> tag in your unique modal with something like.

    $("#img-in-modal").attr("src","big-avatar-" + username + ".jpg")
    

    And open your modal

    $('#myModal').modal('show')
    

    And finally, make sure bootstrap-modal.js or boostrap.js is included.

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

Sidebar

Related Questions

I have a HTML form, which includes radio buttons that the user can select
I have an PHP/HTML main page, in which I include different other PHP files
I have one Page which is displaying details of some Client. I am using
I have a form on my page which gives the user the possibility to
I have a content script running on every page. It updates the html of
I have a web page which includes insane amount of minified JS files. The
I have a formula @InitVars in the page header which includes the following, and
Here's my situation. I have a photo administration page which includes 1) a photo
I have developed an ajax application in which the server page is called every
I have a _Layout.cshtml page which I've used to include all master page styling.

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.