473,623 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to click on image so view large

1 New Member
<img src="http://example.com/images/gallery_3.png" />
Oct 22 '13 #1
3 6488
Dormilich
8,658 Recognized Expert Moderator Expert
Lightbox ?
Oct 22 '13 #2
Sherin
77 New Member
Try This Code

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html>
  2. <html>
  3. <meta name="viewport" content="width=device-width, initial-scale=1">
  4. <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
  5. <body>
  6.  
  7. <div class="w3-container">
  8.   <h2> Image Gallery</h2>
  9.   <p>Click on the images to display them in full size.</p>
  10. </div>
  11.  
  12. <div class="w3-row-padding">
  13.   <div class="w3-container w3-third">
  14.     <img src="img_snowtops.jpg" style="width:100%;cursor:pointer" 
  15.     onclick="onClick(this)" class="w3-hover-opacity">
  16.   </div>
  17.   <div class="w3-container w3-third">
  18.     <img src="img_lights.jpg" style="width:100%;cursor:pointer" 
  19.     onclick="onClick(this)" class="w3-hover-opacity">
  20.   </div>
  21.   <div class="w3-container w3-third">
  22.     <img src="img_mountains.jpg" style="width:100%;cursor:pointer" 
  23.     onclick="onClick(this)" class="w3-hover-opacity">
  24.   </div>
  25. </div>
  26.  
  27. <div id="modal01" class="w3-modal" onclick="this.style.display='none'">
  28.   <span class="w3-button w3-hover-red w3-xlarge w3-display-topright">&times;</span>
  29.   <div class="w3-modal-content w3-animate-zoom">
  30.     <img id="img01" style="width:100%">
  31.   </div>
  32. </div>
  33.  
  34. <script>
  35. function onClick(element) {
  36.   document.getElementById("img01").src = element.src;
  37.   document.getElementById("modal01").style.display = "block";
  38. }
  39. </script>
  40.  
  41. </body>
  42. </html>
  43.  
Oct 23 '20 #3
SwissProgrammer
220 New Member
Sherin,

Nice.


Ahtisham,

You might want to refresh the elements as soon as they are removed so that they zoom in each time that they are clicked. Currently they zoom in the first time, then after being clicked on and removed they simply show up without the zoom. Sherin gave you some nice code. Let us see how you create that new-zoom effect each time that the same one is clicked.

Thanks.
Oct 26 '20 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
4508
by: The Roys | last post by:
I want to be able to detect if an image has been right-clicked. I have 5 images in my program. If I Click the image it gets selected by my program. But I want to be able to Right-Click one of the images which will mean all other images will be selected. eg: Private Sub Image1_Click(Index As Integer) ' I want it to be a R/Click not a Click For x = 0 to 4 If (x <> index) then ImgSelected(x) = True
29
9765
by: lori3laz | last post by:
How do you disable the right click>view source option on web pages so people can't view your coding and copy it? What's the html I need to include in my website to utilize this feature? Thank you.
1
1686
by: deepaks85 | last post by:
Dear Friends, I have created a website in which user can register their profile and view their profile. But when they upload their picture, they can not see their photo in proper view. I want that any user should upload their picture for any size, but at the time of view there should be a standard view to everyone. The picture (image) should be auto adjusted or auto resize while they are viewing their profile like you can see in any...
1
1394
by: Rajendra Prasad | last post by:
Hello, I'm working on project, in which I have to display images when a user select it. And I've to display it subparts from the diagram. It's image and it has part numbers on it.But its image. So I have co-ordinates on database. I have to get the co-ordinates and display corresponding images.
3
1505
underscore
by: underscore | last post by:
To all TSDN am here again to ask your assistance about this problem in updating my project. I have a project ROOM RESERVATION and in my 'setuproom.php' theres a table display of all room names with the image of room stored in mysql blob data types. my problem are 1. when i click a room name in my setuproom.php to edit a certain row it would bring me to the edit.php which the code below which make me mad coz nohting happens or change. 2. i...
8
2253
by: squash+go | last post by:
For an abstract algebra class that I will be teaching, I'm trying to convert a text-based game that I wrote in Common Lisp to a graphical game in javascript. (I know nothing of javascript, but I have three books from the library that I have been s*l*o*w*l*y going through.) Currently I have a large, say, 30x20, table <table id="GameTable" >
1
1951
by: MU | last post by:
Hello Can someone give me some ideas on the best way to do the following? I have a product page and it has 1 large image and 6 thumbnails. The main image is the first photo from a data table for the product. The 6 thumbnails are the next 6 images for the product from the data table. I would like the user to click on the thumbnail and that thumbnail would show in the 1 large image area.
0
8227
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8670
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8613
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8469
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7150
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4074
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4164
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2602
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.