Skip to Content

JavaScript File

URL: https://msk1.devkiru.com/js/jquery.selectbox.min.js
HTTP Status: 200 OK
MIME Type: application/x-javascript
Last Modified: Tue, 26 Dec 2023 01:42:57 GMT
Download Time: Less than a second
Cookies: None
Size: 4 KB
HTTP Headers:  17 headers
Links In:  1 pages
Links Out:  0 links
Images:  0 images
CSS:  0 files
JavaScript:  0 files
OK Issues: No issues found

1/* jQuery SelectBox Styler v1.0.1 | (c) Dimox | http://dimox.name/styling-select-boxes-using-jquery-css/ */

2(function($){$.fn.selectbox=function(){$(this).each(function(){var select=$(this);if(select.prev('span.selectbox').length<1){function doSelect(){var option=select.find('option');var optionSelected=option.filter(':selected');var optionText=option.filter(':first').text();if(optionSelected.length)optionText=optionSelected.text();var ddlist='';for(i=0;i<option.length;i++){var selected='';var disabled=' class="disabled"';if(option.eq(i).is(':selected'))selected=' class="selected sel"';if(option.eq(i).is(':disabled'))selected=disabled;ddlist+='<li'+selected+'>'+option.eq(i).text()+'</li>';}

3var selectbox=$('<span class="selectbox" style="display:inline-block;position:relative">'+'<div class="select" style="float:left;position:relative;z-index:10000"><div class="text">'+optionText+'</div>'+'<b class="trigger"><i class="arrow"></i></b>'+'</div>'+'<div class="dropdown" style="position:absolute;z-index:9999;overflow:auto;overflow-x:hidden;list-style:none">'+'<ul>'+ddlist+'</ul>'+'</div>'+'</span>');select.before(selectbox).css({position:'absolute',top:-99999}

4);var divSelect=selectbox.find('div.select');var divText=selectbox.find('div.text');var dropdown=selectbox.find('div.dropdown');var li=dropdown.find('li');var selectHeight=selectbox.outerHeight();if(dropdown.css('left')=='auto')dropdown.css({left:0}

5);if(dropdown.css('top')=='auto')dropdown.css({top:selectHeight}

6);var liHeight=li.outerHeight();var position=dropdown.css('top');dropdown.hide();divSelect.click(function(){var topOffset=selectbox.offset().top;var bottomOffset=$(window).height()-selectHeight-(topOffset-$(window).scrollTop());if(bottomOffset<0||bottomOffset<liHeight*6){dropdown.height('auto').css({top:'auto',bottom:position}

7);if(dropdown.outerHeight()>topOffset-$(window).scrollTop()-20){dropdown.height(Math.floor((topOffset-$(window).scrollTop()-20)/liHeight)*liHeight);}

8}

9else if(bottomOffset>liHeight*6){dropdown.height('auto').css({bottom:'auto',top:position}

10);if(dropdown.outerHeight()>bottomOffset-20){dropdown.height(Math.floor((bottomOffset-20)/liHeight)*liHeight);}

11}

12$('span.selectbox').css({zIndex:1}

13).removeClass('focused');selectbox.css({zIndex:2}

14);if(dropdown.is(':hidden')){$('div.dropdown:visible').hide();dropdown.show();}

15else{dropdown.hide();}

16return false;}

17);li.hover(function(){$(this).siblings().removeClass('selected');}

18);var selectedText=li.filter('.selected').text();li.filter(':not(.disabled)').click(function(){var liText=$(this).text();if(selectedText!=liText){$(this).addClass('selected sel').siblings().removeClass('selected sel');option.removeAttr('selected').eq($(this).index()).attr('selected',true);selectedText=liText;divText.text(liText);select.change();}

19dropdown.hide();}

20);dropdown.mouseout(function(){dropdown.find('li.sel').addClass('selected');}

21);select.focus(function(){$('span.selectbox').removeClass('focused');selectbox.addClass('focused');}

22).keyup(function(){divText.text(option.filter(':selected').text());li.removeClass('selected sel').eq(option.filter(':selected').index()).addClass('selected sel');}

23);$(document).on('click',function(e){if(!$(e.target).parents().hasClass('selectbox')){dropdown.hide().find('li.sel').addClass('selected');selectbox.removeClass('focused');}

24}

25);}

26doSelect();select.on('refresh',function(){select.prev().remove();doSelect();}

27)}

28}

29);}

30}

31)(jQuery)