Skip to content

Commit 6dad5cc

Browse files
authored
Merge pull request #48 from AyeCode/master
pull
2 parents 2617573 + e970d75 commit 6dad5cc

6 files changed

Lines changed: 40 additions & 37 deletions

File tree

assets/js/countrySelect.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,26 @@
1313
})(function($, window, document, undefined) {
1414
"use strict";
1515
var pluginName = "countrySelect", id = 1, // give each instance its own ID for namespaced event handling
16-
defaults = {
17-
// Default country
18-
defaultCountry: "",
19-
// Position the selected flag inside or outside of the input
20-
defaultStyling: "inside",
21-
// Display only these countries
22-
onlyCountries: [],
23-
// The countries at the top of the list. Defaults to United States and United Kingdom
24-
preferredCountries: [ "us", "gb" ]
25-
}, keys = {
26-
UP: 38,
27-
DOWN: 40,
28-
ENTER: 13,
29-
ESC: 27,
30-
PLUS: 43,
31-
A: 65,
32-
Z: 90
33-
}, windowLoaded = false;
16+
defaults = {
17+
// Default country
18+
defaultCountry: "",
19+
// Position the selected flag inside or outside of the input
20+
defaultStyling: "inside",
21+
// Display only these countries
22+
onlyCountries: [],
23+
// The countries at the top of the list. Defaults to United States and United Kingdom
24+
preferredCountries: [ "us", "gb" ]
25+
}, keys = {
26+
UP: 38,
27+
DOWN: 40,
28+
ENTER: 13,
29+
ESC: 27,
30+
PLUS: 43,
31+
A: 65,
32+
Z: 90
33+
}, windowLoaded = false;
3434
// keep track of if the window.load event has fired as impossible to check after the fact
35-
$(window).load(function() {
35+
$(window).on('load', function() {
3636
windowLoaded = true;
3737
});
3838
function Plugin(element, options) {
@@ -249,7 +249,7 @@
249249
// decide where to position dropdown (depends on position within viewport, and scroll)
250250
_setDropdownPosition: function() {
251251
var inputTop = this.countryInput.offset().top, windowTop = $(window).scrollTop(),
252-
dropdownFitsBelow = inputTop + this.countryInput.outerHeight() + this.dropdownHeight < windowTop + $(window).height(), dropdownFitsAbove = inputTop - this.dropdownHeight > windowTop;
252+
dropdownFitsBelow = inputTop + this.countryInput.outerHeight() + this.dropdownHeight < windowTop + $(window).height(), dropdownFitsAbove = inputTop - this.dropdownHeight > windowTop;
253253
// dropdownHeight - 1 for border
254254
var cssTop = !dropdownFitsBelow && dropdownFitsAbove ? "-" + (this.dropdownHeight - 1) + "px" : "";
255255
this.countryList.css("top", cssTop);
@@ -517,8 +517,8 @@
517517
}
518518
};
519519
/********************
520-
* STATIC METHODS
521-
********************/
520+
* STATIC METHODS
521+
********************/
522522
// get the country data object
523523
$.fn[pluginName].getCountryData = function() {
524524
return allCountries;

0 commit comments

Comments
 (0)