Javascript drop-down menu language options simple implementation _ javascript skills

Source: Internet
Author: User
You are not familiar with the drop-down menu. The following describes how to use js to implement the drop-down menu language options. The specific implementation is as follows.
Flag Image

The Code is as follows:


(Function ($ ){
Var jSelect = $ (". jsSelect ");
$ (JSelect). find ("li: first"). hover (function (){
$ (". S" ).css ("background", "url (images/68_60.png) 54px 0px no-repeat ");
H = $ (this). parent ("ul"). find ("li"). length;
$ (This). parent ("ul" ).css ("height", 28 * h)
$ (This). siblings ("li: not (. s)"). mouseenter (function (){
$ (". S" ).css ("background", "url (images/68_60.png) 54px 0px no-repeat ");
((This).css ("background", "# 428bca" ).css ("color", "# FFFFFF ")
});
$ (This). siblings ("li: not (. s)"). mouseleave (function (){
((This).css ("background", "none" ).css ("color", "# 428bca ")
$ (". S" ).css ("background", "url (images/68_60.png) 54px-30px no-repeat ");
});

$ (This). parent (jSelect). mouseleave (function (){
Watermark (this).css ("height", 28)
});
});
$ (JSelect). find ("li: not (. s)"). click (function (){
Var cContent = $ (jSelect). find ("li: first" pai.html ();
Var cdContent = contents (this).html ();
$ (JSelect). find ("li: first" ).html (cdContent );
Certificate (thisdomain.html (cContent );
$ (This). find ('A'). removeClass ('s ');
$ (This). find ('A'). removeAttr ('style ');
$ (JSelect). find ("li: first"). addClass ('s ');
$ (This). parent ("ul" ).css ("height", 28 );
});
$ (". S" ).css ("background", "url (images/68_60.png) 54px-30px no-repeat ");

}) (JQuery );


The Code is as follows:


  • English
  • Simplified Chinese
  • Traditional Chinese



The Code is as follows:





Flag.css

The Code is as follows:


[Class ^ = "flag-"], [class * = "flag-"] {display: inline-block; margin-top: 2px; width: 16px; height: 11px; line-height: 11px; vertical-align: text-top; background-image: url ("http://file.aconf.org/public/images/icons/flags.png"); background-repeat: no-repeat; * margin-right :. 3em; margin-right: 0.3em}
[Class ^ = "flag-"]: last-child, [class * = "flag-"]: last-child {* margin-left: 0}
. Flag-ad {background-position: 0 0}
. Flag-AE {background-position: 0-31px}
. Flag-af {background-position: 0-62px}
. Flag-ag {background-position: 0-93px}
. Flag-ai {background-position: 0-124px}
. Flag-al {background-position: 0-155px}
. Flag-am {background-position: 0-186px}
. Flag-an {background-position: 0-217px}
. Flag-ao {background-position: 0-248px}
. Flag-ar {background-position: 0-279px}
. Flag-as {background-position: 0-310px}
. Flag-at {background-position: 0-341px}
. Flag-au {background-position: 0-372px}
. Flag-aw {background-position: 0-403px}
. Flag-ax {background-position: 0-434px}
. Flag-az {background-position: 0-pixel PX}
. Flag-ba {background-position: 0-496px}
. Flag-bb {background-position: 0-527px}
. Flag-bd {background-position: 0-558px}
. Flag-be {background-position: 0-589px}
. Flag-bf {background-position: 0-620px}
. Flag-bg {background-position: 0-651px}
. Flag-bh {background-position: 0-682px}
. Flag-bi {background-position: 0-713px}
. Flag-bj {background-position: 0-744px}
. Flag-bm {background-position: 0-775px}
. Flag-bn {background-position: 0-806px}
. Flag-bo {background-position: 0-837px}
. Flag-br {background-position: 0-868px}
. Flag-bs {background-position: 0-899px}
. Flag-bt {background-position: 0-930px}
. Flag-bv {background-position: 0-961px}
. Flag-bw {background-position: 0-992px}
. Flag-by {background-position: 0-1023px}
. Flag-bz {background-position: 0-1054px}
. Flag-ca {background-position: 0-1085px}
. Flag-catalonia {background-position: 0-1116px}
. Flag-cc {background-position: 0-1147px}
. Flag-cd {background-position: 0-1178px}
. Flag-cf {background-position: 0-1209px}
. Flag-cg {background-position: 0-1240px}
. Flag-ch {background-position: 2px-interval 1px}
. Flag-ci {background-position: 0-1302px}
. Flag-ck {background-position: 0-1333px}
. Flag-cl {background-position: 0-1364px}
. Flag-cm {background-position: 0-1395px}
. Flag-zh-cn {background-position: 0-1426px}
. Flag-co {background-position: 0-1457px}
. Flag-cr {background-position: 0-1488px}
. Flag-cs {background-position: 0-1519px}
. Flag-cu {background-position: 0-1550px}
. Flag-cv {background-position: 0-1581px}
. Flag-cx {background-position: 0-1612px}
. Flag-cy {background-position: 0-1643px}
. Flag-cz {background-position: 0-1674px}
. Flag-de {background-position: 0-1705px}
. Flag-dj {background-position: 0-1736px}
. Flag-dk {background-position: 0-1767px}
. Flag-dm {background-position: 0-1798px}
. Flag-do {background-position: 0-1829px}
. Flag-dz {background-position: 0-1860px}
. Flag-ec {background-position: 0-1891px}
. Flag-ee {background-position: 0-1922px}
. Flag-eg {background-position: 0-1953px}
. Flag-eh {background-position:-36px 0}
. Flag-england {background-position:-36px-31px}
. Flag-er {background-position:-36px-62px}
. Flag-es {background-position:-36px-93px}
. Flag-et {background-position:-36px-124px}
. Flag-europeanunion {background-position:-36px-155px}
. Flag-fam {background-position:-36px-186px}
. Flag-fi {background-position:-36px-217px}
. Flag-fj {background-position:-36px-248px}
. Flag-fk {background-position:-36px-279px}
. Flag-fm {background-position:-36px-310px}
. Flag-fo {background-position:-36px-341px}
. Flag-fr {background-position:-36px-372px}
. Flag-ga {background-position:-36px-403px}
. Flag-gb {background-position:-36px-434px}
. Flag-gd {background-position:-36px-pixel PX}
. Flag-ge {background-position:-36px-496px}
. Flag-gf {background-position:-36px-527px}
. Flag-gh {background-position:-36px-558px}
. Flag-gi {background-position:-36px-589px}
. Flag-gl {background-position:-36px-620px}
. Flag-gm {background-position:-36px-651px}
. Flag-gn {background-position:-36px-682px}
. Flag-gp {background-position:-36px-713px}
. Flag-gq {background-position:-36px-744px}
. Flag-gr {background-position:-36px-775px}
. Flag-gs {background-position:-36px-806px}
. Flag-gt {background-position:-36px-837px}
. Flag-gu {background-position:-36px-868px}
. Flag-gw {background-position:-36px-899px}
. Flag-gy {background-position:-36px-930px}
. Flag-hk {background-position:-36px-961px}
. Flag-hm {background-position:-36px-992px}
. Flag-hn {background-position:-36px-1023px}
. Flag-hr {background-position:-36px-1054px}
. Flag-ht {background-position:-36px-1085px}
. Flag-hu {background-position:-36px-1116px}
. Flag-id {background-position:-36px-1147px}
. Flag-ie {background-position:-36px-1178px}
. Flag-il {background-position:-36px-1209px}
. Flag-in {background-position:-36px-1240px}
. Flag-io {background-position:-36px-interval 1px}
. Flag-iq {background-position:-36px-1302px}
. Flag-ir {background-position:-36px-1333px}
. Flag-is {background-position:-36px-1364px}
. Flag-it {background-position:-36px-1395px}
. Flag-jm {background-position:-36px-1426px}
. Flag-jo {background-position:-36px-1457px}
. Flag-jp {background-position:-36px-1488px}
. Flag-ke {background-position:-36px-1519px}
. Flag-kg {background-position:-36px-1550px}
. Flag-kh {background-position:-36px-1581px}
. Flag-ki {background-position:-36px-1612px}
. Flag-km {background-position:-36px-1643px}
. Flag-kn {background-position:-36px-1674px}
. Flag-kp {background-position:-36px-1705px}
. Flag-kr {background-position:-36px-1736px}
. Flag-kw {background-position:-36px-1767px}
. Flag-ky {background-position:-36px-1798px}
. Flag-kz {background-position:-36px-1829px}
. Flag-la {background-position:-36px-1860px}
. Flag-lb {background-position:-36px-1891px}
. Flag-lc {background-position:-36px-1922px}
. Flag-li {background-position:-36px-1953px}
. Flag-lk {background-position:-72px 0}
. Flag-lr {background-position:-72px-31px}
. Flag-ls {background-position:-72px-62px}
. Flag-lt {background-position:-72px-93px}
. Flag-lu {background-position:-72px-124px}
. Flag-lv {background-position:-72px-155px}
. Flag-ly {background-position:-72px-186px}
. Flag-ma {background-position:-72px-217px}
. Flag-mc {background-position:-72px-248px}
. Flag-md {background-position:-72px-279px}
. Flag-me {background-position:-72px-310px}
. Flag-mg {background-position:-72px-342px}
. Flag-mh {background-position:-72px-373px}
. Flag-mk {background-position:-72px-404px}
. Flag-ml {background-position:-72px-435px}
. Flag-mm {background-position:-72px-466px}
. Flag-mn {background-position:-72px-497px}
. Flag-mo {background-position:-72px-528px}
. Flag-mp {background-position:-72px-559px}
. Flag-mq {background-position:-72px-590px}
. Flag-mr {background-position:-72px-621px}
. Flag-ms {background-position:-72px-652px}
. Flag-mt {background-position:-72px-683px}
. Flag-mu {background-position:-72px-714px}
. Flag-mv {background-position:-72px-745px}
. Flag-mw {background-position:-72px-776px}
. Flag-mx {background-position:-72px-807px}
. Flag-my {background-position:-72px-838px}
. Flag-mz {background-position:-72px-869px}
. Flag-na {background-position:-72px-900px}
. Flag-nc {background-position:-72px-931px}
. Flag-ne {background-position:-72px-962px}
. Flag-nf {background-position:-72px-993px}
. Flag-ng {background-position:-72px-1024px}
. Flag-ni {background-position:-72px-1055px}
. Flag-nl {background-position:-72px-1086px}
. Flag-no {background-position:-72px-1117px}
. Flag-np {background-position:-68px-1148px}
. Flag-nr {background-position:-72px-1179px}
. Flag-nu {background-position:-72px-1210px}
. Flag-nz {background-position:-72px-1241px}
. Flag-om {background-position:-72px-1272px}
. Flag-pa {background-position:-72px-1303px}
. Flag-pe {background-position:-72px-1334px}
. Flag-pf {background-position:-72px-1365px}
. Flag-pg {background-position:-72px-1396px}
. Flag-ph {background-position:-72px-1427px}
. Flag-pk {background-position:-72px-1458px}
. Flag-pl {background-position:-72px-1489px}
. Flag-pm {background-position:-72px-1520px}
. Flag-pn {background-position:-72px-1551px}
. Flag-pr {background-position:-72px-1582px}
. Flag-ps {background-position:-72px-1613px}
. Flag-pt {background-position:-72px-1644px}
. Flag-pw {background-position:-72px-1675px}
. Flag-py {background-position:-72px-1706px}
. Flag-qa {background-position:-72px-1737px}
. Flag-re {background-position:-72px-1768px}
. Flag-ro {background-position:-72px-1799px}
. Flag-rs {background-position:-72px-1830px}
. Flag-ru {background-position:-72px-1861px}
. Flag-rw {background-position:-72px-1892px}
. Flag-sa {background-position:-72px-1923px}
. Flag-sb {background-position:-72px-1954px}
. Flag-SC {background-position:-pixel PX 0}
. Flag-scotland {background-position:-pixel PX-31px}
. Flag-sd {background-position:-pixel PX-62px}
. Flag-se {background-position:-pixel PX-93px}
. Flag-sg {background-position:-pixel PX-124px}
. Flag-sh {background-position:-pixel PX-155px}
. Flag-si {background-position:-pixel PX-186px}
. Flag-sj {background-position:-pixel PX-217px}
. Flag-sk {background-position:-pixel PX-248px}
. Flag-sl {background-position:-pixel PX-279px}
. Flag-sm {background-position:-pixel PX-310px}
. Flag-sn {background-position:-pixel PX-341px}
. Flag-so {background-position:-pixel PX-372px}
. Flag-sr {background-position:-pixel PX-403px}
. Flag-st {background-position:-pixel PX-434px}
. Flag-sv {background-position:-pixel PX}
. Flag-sy {background-position:-pixel PX-496px}
. Flag-sz {background-position:-pixel PX-527px}
. Flag-tc {background-position:-pixel PX-558px}
. Flag-td {background-position:-pixel PX-589px}
. Flag-tf {background-position:-pixel PX-620px}
. Flag-tg {background-position:-pixel PX-651px}
. Flag-th {background-position:-pixel PX-682px}
. Flag-tj {background-position:-pixel PX-713px}
. Flag-tk {background-position:-pixel PX-744px}
. Flag-tl {background-position:-pixel PX-775px}
. Flag-tm {background-position:-pixel PX-806px}
. Flag-tn {background-position:-pixel PX-837px}
. Flag-to {background-position:-pixel PX-868px}
. Flag-tr {background-position:-pixel PX-899px}
. Flag-tt {background-position:-pixel PX-930px}
. Flag-TV {background-position:-pixel PX-961px}
. Flag-zh-tw {background-position:-pixel PX-992px}
. Flag-tz {background-position:-pixel PX-1023px}
. Flag-ua {background-position:-pixel PX-1054px}
. Flag-ug {background-position:-pixel PX-1085px}
. Flag-um {background-position:-pixel PX-1116px}
. Flag-en-us {background-position:-pixel PX-1147px}
. Flag-uy {background-position:-pixel PX-1178px}
. Flag-uz {background-position:-pixel PX-1209px}
. Flag-va {background-position:-pixel PX-1240px}
. Flag-vc {background-position:-pixel PX-interval 1px}
. Flag-ve {background-position:-pixel PX-1302px}
. Flag-vg {background-position:-pixel PX-1333px}
. Flag-vi {background-position:-pixel PX-1364px}
. Flag-vn {background-position:-pixel PX-1395px}
. Flag-vu {background-position:-pixel PX-1426px}
. Flag-wales {background-position:-pixel PX-1457px}
. Flag-wf {background-position:-pixel PX-1488px}
. Flag-ws {background-position:-pixel PX-1519px}
. Flag-ye {background-position:-pixel PX-1550px}
. Flag-yt {background-position:-pixel PX-1581px}
. Flag-za {background-position:-pixel PX-1612px}
. Flag-zm {background-position:-pixel PX-1643px}
. Flag-zw {background-position:-pixel PX-1674px}

Related Article

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.