Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use AmazeUI to realize the effect of File selection Domain in html5

2025-03-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the html5 how to use AmazeUI to achieve file selection domain effect related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe everyone in this html5 how to use AmazeUI to achieve file selection domain effect article will have a harvest, let's take a look at it.

File selection domain

It is also a bone that CSS can not gnaw on. If you really don't like the original style, the general practice is to set the file selection field to the transparent one and cover other elements.

Select files to upload. Select files to upload.

The effect is as follows:

But one problem with the official solution is that the icon does not change after uploading the file, and it does not show the place where the file name is uploaded.

So I made a small change: add a piece of js code:

Change (function (event) {var that = $(that) [0] .files [0]; if (file) {$(that). Prev () .text (that.files [0] .name); $(that) .attr ({'src': window.URL.createObjectURL (that.files [0])});})

After uploading the file

Furthermore, if you upload a picture, I want to preview the effect of the uploaded picture.

Then add a little code:

Closest ('div') .hover (function () {if ($(this). Find (' input [type = "file"]'). Attr ('src')) {$(' body'). Append (')

')}, function () {$(' .imgView') .remove ()

When the mouse is over, the thumbnail of the uploaded picture will be automatically displayed.

This is the end of the article on "how to use AmazeUI to achieve the effect of file selection domain in html5". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to use AmazeUI to achieve file selection domain effect in html5". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report