Asp.net point thumbnails pop-up page with the image size automatically adjusted

Source: Internet
Author: User

In addition, you can click the previous image or the next image to flip the page.
The implementation process is as follows:
Pic_small.aspx Code Is: Copy code The Code is as follows: ) "src = '<% #" images/product/"+ databinder. eval (container. dataitem, "picurl") %> 'width = "118" runat = "server">
Showwindow is saved in the openwindows. js file with the following content:
Functionshowwindow (ID)
{
Window. Open ('pic _ all. aspx? Id = '+ id,' _ blank ', 'rollbars = no ');
}

The following code displays the image information on the pic_all.aspx page after a thumbnail is clicked. The pic_all.aspx page is automatically adjusted based on the image size.
Place the following code between Copy codeThe Code is as follows: <SCRIPT>
Functionwindow. onload ()
{
Varobj = Document. getelementbyid ("picurl ");
Window. resizeTo (obj. offsetwidth + 127, obj. offsetheight + 75 );
}
</SCRIPT>

Here, picurl is used to display the source image size in pic_all.aspx. I use the HTML control. No matter what method you use, you need to read the image name or path from the database.
OBJ. offsetwidth returns the width of the displayed source image, obj. offsetwidth + 127 indicates that the window is 127 pixels larger than the image width, because you need to leave some space for the image description.
In this way, the pop-up window can be automatically adjusted according to the image size, and the pop-up page can be edited at will, because the pop-up page is a specified page, no matter what you want to edit, You can process the page as usual.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.