Giter Club home page Giter Club logo

uniform's Introduction

(jQuery) Uniform

A jQuery plugin to make your form controls look how you want them to. Now with HTML-5 attributes!

Works well with jQuery 1.6+, but we've received patches and heard that this works with jQuery 1.3.

Version 4.3.x uses jQuery 3.3.1+ and so far, things look promising.

NPM Total Downloads Contributors License

Installation

Packaging of Uniform comes with source SASS files and minified CSS files, ready for consumption in live/production environment. You can install Uniform via one of two methods listed below:

Via NPM

NPM Monthly Downloads NPM Total Downloads

Simply run:

npm install --save @imanov/jquery.uniform

To create minified file, run (though this isn't necessary, as the minified file is already included in the package):

npm run build

Minified source file will be built inside dist/ folder.

Via Public CDN

CDNJS jsDelivr Hits

Un-minified CSS files

For your own development purposes, to get human-readable, un-minified CSS outputs, you will need to install Uniform via NPM (as shown above), install the necessary dependencies through npm install and then run gulp. Doing so will recreate readable CSS files in dist/css folder. Invoking gulp --production however, will recreate minified CSS files (which is default behavior, what we already have in the dist folder).

Implementation

There are two ways to go with this:

Basic Implementation

Basically, you can use the final assets provided in dist folder out of the box.

Stylesheets and Javascript files should be linked in the <header> of your markup (the latter, coming after jQuery):

<!-- Make sure your CSS file is listed before Javascript sources -->
<link rel="stylesheet" href="/path-to-my-assets/uniform/dist/css/default.css" media="screen">
<script src="/path-to-my-assets/jquery/dist/jquery.min.js"></script>
<script src="/path-to-my-assets/uniform/dist/js/jquery.uniform.standalone.js"></script>

Or if you are using our bundled version - jquery.uniform.bundled.js file - which already comes with jQuery (beware not to include jQuery twice):

<!-- Make sure your CSS file is listed before Javascript sources -->
<link rel="stylesheet" href="/path-to-my-assets/uniform/dist/css/default.css" media="screen">
<script src="/path-to-my-assets/uniform/dist/js/jquery.uniform.bundled.js"></script>

Advanced Implementation

To have more control over your web assets, you can directly work with our SCSS and JS files, by importing them into or bundling with your own assets. Please be advised that our Gulp configuration (via Laravel-Elixir package) includes Auto-prefixer, i.e. browser prefixes are automatically added to CSS during the post-processing of SCSS files. Whatever your post-processing solution will be (Gulp-based or Compass), you need to make sure to include Auto-prefixer in that workflow. Our SCSS source files do not include browser prefixes out of the box!

Usage

See our Wiki page for documentation.

Reporting Bugs

It sure would be handy if you could create a test page to help illustrate bugs. When you use the GitHub Issue Tracker, you could use this jsfiddle to help illustrate your point. Additionally, we have provided some demo pages in /demo folder for you to use.

Even if you don't use these assets, all sorts of feedback is welcome, but narrowing down your problem or providing an example would immediately help narrow down the problem quickly.

Contributor/Developer Assets

We have created a Docker container to help our contributors with development of Uniform.

Additionally, /dev folder contains following assets, to further enhance our capabilities:

  1. docker folder contains necessary Dockerfile to build the container.
  2. theme-kit contains assets to help you create new themes.
  3. build.sh script, which basically spins a Docker container up and builds the package, using that instance.

uniform's People

Contributors

ahmedshaikhm avatar alexshk avatar arthuryeti avatar benjamincurrie avatar bonpixel avatar brenton-vidcorp avatar daniel-franz avatar dingram avatar everzet avatar fidian avatar friscomad avatar gianlucaguarini avatar groxx avatar issa-tseng avatar jorgenskogas avatar kcivey avatar littke avatar lukasdrgon avatar manish-in-java avatar merbjedi avatar michaelmulley avatar michaelplaxico avatar pixelmatrix avatar schweighart avatar shehi avatar spiderneo1 avatar spolischook avatar stephaneheav avatar superp avatar themecatcher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uniform's Issues

Select elements can not have width set in CSS

Seems that selects does not respect width set in CSS, such as width:300px, or width:100%

Would be nice if the width was pulled from the width of the select element it is to replace instead of being set in the CSS for uniform itself.

Handling multiple set of radio buttons

Hi,

Is there a way I can handle two sets of radio buttons in the form, as of now, the uniform plugin acts on all the radio buttons of the form, irrespective of whether they share the same name or not.

Thanks,
Nagaraj

Untitled

I tried setting the useID parameter in the options to false, but it didn't seem to make a difference. Tried dynamically setting IDs of elements before adding them to the primary DOM tree, but it didn't seem to make a difference. Effectively does nothing in this case.

Chrome mac select rendering bug

Chrome Mac is still in beta but after using a select pull down the left hand end of the select drops down around 3px resulting in a "tear" in the image.

Support for multiple selects

Uniform needs to support multiple selects in order for it to be fully useful. Do you have any plans to implement this in the near future?

Any plans to add support for input type="search" ?

It's mainly a type="text" field, but on some browsers (it's HTML5) it gives you additional funcionality (like a stylized search box in Safari, a cache of search terms, etc). Having to use external scripts to stylize it these days...

navbar as a menu?

Aristo has in it's design a topbar menu bar. Is there a plan to add it to uniform?

Buttons mousedown and mouseup events

The button mousedown and mouseup events don't get called (in Safari or FF anyway) so active state does not work in FF. Active state for buttons works in Safari because it supports :active.

Size attribute on Select

If you add the size attribute on a select element so that it's no longer a drop down, uniform still formats it as a drop down and it breaks. Any way to make it ignore the select element when size is defined?

I realize that I could just assign uniform to work with specific drop downs, but it's a Wordpress site with many drop downs being dynamically created.

Activated select causes background-offset of .selector span in webkit browsers

Just noticed on webkit browsers (Chrome, Safari on OS X):

When a select is activated it causes a background-offset of .selector span according to the value given in uniform.default.css line 58 and 61. That means that "top: 3px" causes the background of .selector span to move 3px upwards so that the whole select looks destroyed.

You can avoid that by removing either the top/bottom values in lines 58, 61 or better by removing the height of the select on line 398 of uniform.default.css

Uniform and JQuery UI bug

Hello,

I'm trying to use uniform and jQuery Ui togheter, but isn't working. In the header I call jquery, jquery ui and the js file where I set up the dialog and datepicker from jquery ui. After them I call uniform, everything is on the right place. But doing this way, uniform doesn't work, and if I invert jquery ui and uniform, the dialog and datepicker stop working. Any one know why this is happening?

Also, I call uniform in other pages, but just the first element of the form get stylized, know why?

regards,

RA

Calling the script - IE8

Hi,
So I worked out the CSS and added about it in your wiki. Perhaps it will make it somewhat clearer.
The problem is that I don't get it to work in IE - in my case IE8. It is fine in Firefox and Chrome.

This is my head script:
[code]<script type='text/javascript'>
jQuery(document).ready(function($){
$("select, input:checkbox, input:radio, input:file").uniform();
});
</script>[/code]

It does not really want to work with $ instead of jQuery in it, it does not really work with the syntax sugested in wiki: $(“select, input[type=checkbox], input[type=radio], input[type=file]”).uniform();.
It works the way I show it above in my [code][/code], not in IE though. Any ideas? DO I mix sth? Is the syntax in .js files different than in HTML [code]<script>[/code] tags?

$.uniform.update not working

Hey Josh, if you goto your example page http://pixelmatrixdesign.com/uniform/ and within the console enter: $.uniform.update("input[value='check1']"); and nothing happens. I'm expecting check box 1 to be checked/unchecked.

Is that correct? I'm trying to dynamically check a checkbox and $.uniform.update doesn't seem to be working.

Thanks man!

Intuitive input width needed

Seems like the better option for unifying form design but its not as flexible as it might be.

Seems its difficult to size form items such as the select unless the size is uniform across a site. I would like to specify the width of different selects placed for different use throughout the site but to do this would require a few lines of css for each select which is a bit cumbersome. Would be ideal if the script could grab the width attribute, possibly other attributes given to the original select or indeed to the selector class and apply the necessary changes to "div.selector select" and "div.selector span" for example.

Nice job though, keeping the original functionality of the dropdown of a select is ideal.

Each form element have same id?

I see that every wrapper created has a uniform- id. This breaks the semantic because you are creating various elements with the same id. i see that there's a option to change for other id, but this way will still have duplicates id's, that should be unique in a page.

The plugin it's great!

Add a README to repository

You should add a README with some information about the project like Installation, etc. I know that it is present on the project page but won't hurt to have it here in the repository as well.

Custom setup issues...

Hello, I'm attempting to implement Uniform on a large website. I've made a few custom alterations that should work, but I'm not having any luck. I'll do my best to explain everything I've done....

  1. CSS
    I've copy/pasted the uniform css data into our single CSS file (I'd rather just have 1 css file).
  2. SPRITE
    I've placed the sprite image in our main graphics directly (and updated the div.uploader span.action { background-image: url() } to reflect the correct URL
  3. JS
    I am, via PHP, 'including' the uniform.js file BEFORE making the $("select").uniform(); call.

The result, when I load the page, is that the dropdown is un-styled (see-thru background). The dropdown is clickable (ie, when i click on it, i see the options), but I'm not seeing the background image(s).

I'll be more than happy to discuss via email and provide URLs for viewing...

Thanks!

Use inline block for checkboxes and radio button

Here is how I change the rules:

div.checker {
position: relative;
display: -moz-inline-stack;
display: inline-block;
zoom: 1;
*display: inline;
vertical-align: middle;
}

Please consider it in the next version, thank you.

Keyboard navigation

Is it me, or are the sexy form controls not accessible via the keyboard? :(

Hey Guys - Styling Advice Kindly Requested :P

Any Idea how to style the width of a select? http://broneg.pl is the address. The problem is clearly visible - IT is to wide. I do not really get the structure of this css cause it is not really applying to my existing classes. How does it work? Can I move the select with normal padding in my main css. THX!

$..uniform.update() does not properly setup selects

When adding select boxes dynamically $.uniform.update() does not set them up properly. It looks as if a change function needs to be added to when the user changes what is selected it gets registered.

The fix is below: (just the conditional related to selects)

           if($e.is("select")){
                //element is a select
                var spanTag = $e.siblings("span");
                var divTag = $e.parent("div");

                divTag.removeClass(options.hoverClass+" "+options.focusClass+" "+options.activeClass);
                var etext = $e.find(":selected").text();
                //reset current selected text
                spanTag.html($e.find(":selected").text());

                if($e.is(":disabled")){
                    divTag.addClass(options.disabledClass);
                }else{
                    divTag.removeClass(options.disabledClass);
                }
                // this is the fix which will allow dynamically added select boxes to work properly
                $e.change(function() {
                    spanTag.text($e.find(":selected").text());
                    divTag.removeClass(options.activeClass);
                });

            }else if($e.is(":checkbox")){

Disallow text selection inside `label`s

I think it would be a useful addition to disallow text selection inside labels.

When rapidly clicking a label several times (to select/deselect its radio button), the label text gets selected.

Feel free to use my noSelect jQuery plugin for this.

I would be willing to create a patch for this if you’re interested.

Doesn't play nice with line-height

Hey, love this plugin, but it doesn't appear to play well with line-height. Using the Blueprint CSS framework, for example, which relies on line-height to align inline forms vertically. Basically what happens is that the Uniform element is rendered as though line-height is 1, but the clickable area is where it's supposed to be (line-height:3, in Blueprint's case). If you need a demo of the problem let me know and I'll post one.

Opacity in IE7

I'm noticing in some versions of IE7 that the opacity doesn't seem to be working on the form elements. The original radio, file upload and select boxes will continue to show up over the styled form inputs.

I think it has to do with style="opacity:0" not being compatible with IE7. Not even the demo on the homepage works.

Aristo theme wraps long <select> boxes

I noticed that the Aristo theme incorrectly wraps long options in elements (http://drp.ly/17ID4P), whereas the default theme does more elegant overflow handling. I simply borrowed the CSS from the default theme and added it to Aristo: div.selector { position: relative; padding-left: 10px; overflow: hidden; } div.selector span { display: block; float: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } Is the Aristo uniform theme on GitHub anywhere? It would be very useful if so :)

Select stays open after click and drag in IE

When i click on the uniform select and hold the mousebutton down, the select options appear.
Then i move to the option i want to select with my mousebutton still pressed. When i let go the mousebutton, the options stay open and the option i wanted to select doesn´t get selected.
Tested in IE 7.

What about input:submit

I want change default style for submit buttons,
but next code was not worked for me

$(document).ready(function() {
$("select, input:checkbox, input:radio, input:file, button, input:submit").uniform();
});

What do you think about it ??

Does not support Opera

I came across your webpage and I liked how simple uniform is, but when I tested on opera it does not work. I will use this plugin when it supports all major browsers.

Good luck :)

File input display wrong under Opera

In doFile():
.change(function(){
var filename = $el.val();
filename = filename.split("/");
filename = filename[(filename.length-1)];
filenameTag.text($el.val());
})
should probably read:
.change(function(){
var filename = $(this).val();
filename = filename.split(/[/]/);
filename = filename[(filename.length-1)];
filenameTag.text(filename);
})
In order to split filenames on both forward and backward slashes. Also, I have fixed the fact that filename is calculated and then ignored. I have also incorporated the fix from larsboldt in Issue #13 when getting the filename.

Support for Select OptGroups?

Select boxes with optgroups cause strange behaviour in Safari and Firefox.
Selected option is either hidden or multiple options appear over the select sprite.

Any plans to support optgroups?

multiple file input fails - fix included

in function doFile - change
Original:
.change(function(){
var filename = $el.val();
filename = filename.split("/");
filename = filename[(filename.length-1)];
filenameTag.text($el.val());
})

Fix:
.change(function(){
var filename = $(this).val();
filename = filename.split("/");
filename = filename[(filename.length-1)];
filenameTag.text($(this).val());
})

With the original code, all file inputs would take the last file inputs value instead of its own and fail.

Cheers
Lars

File name on IE

Hi, in the file uploader, the file name displayed after a file is selected is the whole file path, not simply the name. Starting at line 316 (version 1.5), I'd suggest:

var filename = $el.val();
filename = filename.split("/");
filename = filename[(filename.length - 1)];
filename = filename.split("");
filename = filename[(filename.length - 1)];
filenameTag.text(filename);

(Please pardon if there is already a ticket for this.)

Cheers,

  • Matt

ie6 support

Yah i'm gonna be that a-hole. :)

This is a super solid plugin but so many developers can't put it to use without ie6.

If you want to close this as a WONTFIX, i'd love to see your ie6 guide.. as in.. "No modifications will be made at all in ie6." so at least we know it wont totally blow up. :)

Problem with Select fields when no options are selected

When I run uniform() on a select form element that doesn't have one of its options selected, then the uniform shows a blank value for the display. I think it should probably show what the dropdown would have showed (defaulting to selecting the text of the first item). What do you think?

Consider darkening the basic theme a bit?

One of my users mentioned that the checkboxes are a bit hard to see on my site -- a bit washed out. Maybe they should be darkened just a bit, for greater contrast?

I did so on the sprite using Levels in Photoshop -- it's a good way to darken across all shades in an even way. Looks better, imho.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.