Jump to content
  • 0

Выравнивание пунктов меню с задержкой


m1kas
 Share

Question

Стили меню прописаны следующим образом. При загрузке страницы, все пункты меню сдвигаются влево в кучу (float:left). Спустя секунду только встают на свои места. Что тут не так?

div.top-menu-holder {width: 959px;margin: 0px auto;}div.top-menu {position: absolute;width: 957px;height: 50px;border: 1px #e1e2e6 solid;background-color: white;margin-top: -26px;overflow: hidden;}div.top-menu ul {padding: 0px;margin: 0px;list-style: none;width: 100%;overflow: hidden; background: white}div.top-menu ul li {display: block;float: left;background: url(images/menu-sep.gif) no-repeat left 20px;font-size: 11px;text-transform: uppercase;}div.top-menu ul li a {display: block;padding-top: 18px;padding-bottom: 18px;color: #090c0d;text-decoration: none;}div.top-menu ul li a:hover, div.top-menu ul li a.activ, div.top-menu ul li a.activ:hover {color: #e21544;text-decoration: none;}
Edited by m1kas
Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Вот это:

$(window).load(function(){    links = $("div.top-menu ul li a");    wdth = 0;    for (i=0;i<links.length;i++) {        wdth += $(links[i]).width();    }    pads = Math.round(((957-wdth)/links.length)/2);    $("div.top-menu ul li a").css({        "padding-left":pads+'px',        "padding-right":pads+'px'    });});

заменить на это:

$(function(){    links = $("div.top-menu ul li a");    wdth = 0;    for (i=0;i<links.length;i++) {        wdth += $(links[i]).width();    }    pads = Math.round(((957-wdth)/links.length)/2);    $("div.top-menu ul li a").css({        "padding-left":pads+'px',        "padding-right":pads+'px'    });});
Link to comment
Share on other sites

  • 0

 

Вот это:

$(window).load(function(){    links = $("div.top-menu ul li a");    wdth = 0;    for (i=0;i<links.length;i++) {        wdth += $(links[i]).width();    }    pads = Math.round(((957-wdth)/links.length)/2);    $("div.top-menu ul li a").css({        "padding-left":pads+'px',        "padding-right":pads+'px'    });});

заменить на это:

$(function(){    links = $("div.top-menu ul li a");    wdth = 0;    for (i=0;i<links.length;i++) {        wdth += $(links[i]).width();    }    pads = Math.round(((957-wdth)/links.length)/2);    $("div.top-menu ul li a").css({        "padding-left":pads+'px',        "padding-right":pads+'px'    });});

 

Спасибо большое! Очень помогли! 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy