简体   繁体   English

样式选择元素(jQuery)

[英]Styling select element (jQuery)

I tried some plugins but they all come with their own styling which takes quite some time to get rid of. 我尝试了一些插件,但是它们都带有自己的样式,这需要相当长的时间才能摆脱。 Is there any plugin with minimal styling (or a really simple way) to apply custom background to select element? 是否有任何具有最小样式(或非常简单的方式)的插件将自定义背景应用于选择元素? I just need something very simple. 我只需要一些简单的东西。

Thanks 谢谢

I found this one. 我找到了这个。 It even degrades automatically if JavaScript is disabled. 如果禁用JavaScript,它甚至会自动降级。

http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/ http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/

With jQuery am using lines like this in my dom ready function : 使用jQuery在我的dom ready函数中使用这样的行:

$(".overlay").css("top","300px");

Goes like this in the header: 在标题中是这样的:

<script type="text/javascript">
jQuery(document).ready(function(){
$(".overlay").css("backgroundColor": "#0f0");
}); 
</script>

.overlay is the class of the div i wanna change and then comes the css property and its value. .overlay是我要更改的div的类,然后是css属性及其值。 Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM