Uploadify How to use a custom button

Source: Internet
Author: User

In the Uploadify plugin comes with a file package with a CSS file uploadidfy.css, in this file defines the Uploadify button style, which is the default style of the button. So how do you use a custom style?

In three steps.

One, specify the background image using the button in the JS code that initializes the Uploadify

 //  upload article with picture  $ (' #upBtn ' ). uploadify ({ ' swf ': '/public/uploadify/uploadify.swf ' ,  ' Uploader ': '/submit/uploadtextimg '  ' buttonimage ': '/public/img/main.png ' 
    
     , 
     ' width ': 88 ' height ': 24,  ' onuploadsuccess ': function   (file, data , response) { // alert (' the file was S            Aved to: ' + data ';         $ ("#pic_container"). HTML (" "

"Buttonimage" is the background image you need to customize. Note: The width and Height properties are the height of the buttons you need to define. Otherwise it will be the default width of the 120*30.

Two, comment out the two styles in uploadify (note, to override their style in a file to use a custom style)

/*. Uploadify-button {background-color: #505050;    Background-image:linear-gradient (Bottom, #505050 0, #707070 100%);    Background-image:-o-linear-gradient (Bottom, #505050 0, #707070 100%);    Background-image:-moz-linear-gradient (Bottom, #505050 0, #707070 100%);    Background-image:-webkit-linear-gradient (Bottom, #505050 0, #707070 100%);    Background-image:-ms-linear-gradient (Bottom, #505050 0, #707070 100%);        Background-image:-webkit-gradient (linear, left bottom, left top, color-stop (0, #505050),    Color-stop (1, #707070));    Background-position:center top;    Background-repeat:no-repeat;    -webkit-border-radius:30px;    -moz-border-radius:30px;    border-radius:30px;    border:2px solid #808080;    Color: #FFF;    Font:bold 12px Arial, Helvetica, Sans-serif;    Text-align:center;    text-shadow:0 -1px 0 Rgba (0,0,0,0.25); width:100%;}.    Uploadify:hover. Uploadify-button {background-color: #606060; background-Image:linear-gradient (Top, #606060 0, #808080 100%);    Background-image:-o-linear-gradient (Top, #606060 0, #808080 100%);    Background-image:-moz-linear-gradient (Top, #606060 0, #808080 100%);    Background-image:-webkit-linear-gradient (Top, #606060 0, #808080 100%);    Background-image:-ms-linear-gradient (Top, #606060 0, #808080 100%);        Background-image:-webkit-gradient (linear, left bottom, left top, color-stop (0, #606060),    Color-stop (1, #808080));    Background-position:center Bottom; }*/

Third, rewrite these two styles in a page that requires a custom style

{    background-position:-224px-195px;}

The second style is not written here, that is, the style is not defined when hovering the mouse. The location where the background is defined is actually the background picture path defined by "Buttonimage" in the first step.

Uploadify How to use a custom button

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.