Перейти к содержимому
Fozzy

Fozzy

На сайте с 13 сентября 2011 г.

Пользователь пока ничего не рассказал о себе.

рейтинг

100

постов

8

комменты

0

подписчик

1

подписок

0

В IE и opera optgroup и option не скрываются стандартным jquery hide или css display:none

//В IE и opera optgroup и option не скрываются стандартным jquery hide или css display:none

  1. $.fn.hideOptgroup = function() {
  2. this.each(function() {
  3. if ($(this).is('optgroup') && (!$(this).parent().is('span'))) {
  4. $(this).wrap('<span>').hide();
  5. }
  6. });
  7. };
  8.  
  9. $.fn.showOptgroup = function() {
  10. this.each(function() {
  11. if (this.nodeName.toLowerCase() === 'optgroup') {
  12. var p = $(this).parent(),
  13. o = this;
  14. $(o).show();
  15. $(p).replaceWith(o);
  16. } else {
  17. var opt = $('optgroup', $(this));
  18. $(this).replaceWith(opt);
  19. opt.show();
  20. }
  21. });
  22. };

http://work.arounds.org/issue/96/option-elements-do-not-hide-in-IE/

 
0
1
504

Пример HTML и CSS: закругление углов с использованием боковых блоков

 
   .tab
{
cursor:default;
font-size:18pt;
margin-left:40px;
height: 46px;
line-height:46px;
font-family:Times New Roman;
position: relative;
text-align: center;
background:url('images/trade-tab-select-center.jpg') repeat-x;
padding: 0px 40px;
color:#a2a3a6;
display:inline-block;
}
.left, .right{
width: 7px;
height: 46px;
font-size: 0;
overflow: hidden;
position: absolute;
top: 0;
}
.left{
background: url('images/trade-tab-select-left.jpg') no-repeat;
left: 0;
}
.right{
background: url('images/trade-tab-select-right.jpg') no-repeat;
right: 0; /* нулевое смещение справа */
margin-left: 100%; /* для IE6 */
left: -7px; /* для IE6 */
}

</style>  <body> <div class="tab"> Главная <span class="left"></span> <span class="right"></span> </div> </body>
 
0
0
469

Yandex text input с тенью

yandex text input с тенью

css
  1. <style>
  2. .b-form-input{display:block}
  3. .b-form-input__box{display:block;padding-left:.3em;border:1px solid}
  4. .b-form-input__box{height:26px;}
  5. .b-form-input__box{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;border-color:#a3a3a3 #c6c6c6 #e5e5e5;background:#fff;-webkit-box-shadow:inset 0 1px 1px #cfcfcf;-moz-box-shadow:inset 0 1px 1px #cfcfcf;box-shadow:inset 0 1px 1px #cfcfcf}
  6. .b-form-input__input{font:100% Arial,sans-serif;width:100%;height:100%;margin:0;border:0}
  7. .b-form-input__input{font-size:16px}
  8. .b-form-input__input{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;outline:0;background:none}
  9. </style>
HTML
  1. <span class="b-form-input">
  2. <span class="b-form-input__box">
  3. <input autocomplete="off" name="text" value="" maxlength="400" tabindex="1" class="b-form-input__input">
  4. </span>
  5. </span>
     
0
1
458

Условные комментарии для IE

Условные комментарии для IE

Будут работать только в Internet Explorer не ниже 5-ой версии.

<!--[if IE]> Инструкции для Internet Explorer <![endif]-->
<!--[if IE 5]> Инструкции для IE 5 <![endif]-->
<!--[if IE 5.0]> Инструкции для IE 5.0 <![endif]-->
<!--[if IE 5.5]> Инструкции для IE 5.5 <![endif]-->
<!--[if IE 6]> Инструкции для IE 6 <![endif]-->
<!--[if IE 7]> Инструкции для IE 7 <![endif]-->

В условных комментариях можно использовать операторы, с помощью которых можно задать более комплексное условие. В таблице ниже приведены все операторы.

ОператорОписание
ltменьше чем
lteменьше или равно
gtбольше чем
gteбольше или равно

И несколько примеров:

<!--[if ! IE 5]> Инструкции для  IE 5.5, 6 или 7 <![endif]-->
<!--[if gt IE 5.0]> Инструкции для IE 5.5, 6 или 7 <![endif]-->
<!--[if lte IE 5.5]> Инструкции для IE 5.0 или 5.5 <![endif]-->
<!--[if gte IE 6]> Инструкции для IE 6 или 7 <![endif]-->
<!--[if lt IE 7]> Инструкции для IE 5.0, 5.5 или 6 <![endif]-->
0
0
356

INPUT который принимает только цифры.

 

Jquery, JavaScript

 
  1. $(document).ready(function () {
  2. //Привязываем проверку к текстовым полям с классом .number
  3. $('input.number').keypress(function (e) {
  4. //Если символ - не цифра, выводится сообщение об ошибке.
  5. if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
  6. //Вывод сообщения об ошибке
  7. $("#error_message").html("Только цифры!").show().fadeOut("slow");
  8. //Устанавливаем координаты ошибки
  9. $("#error_message").offset({ top: $(this).offset().top, left: $(this).offset().left });
  10. e.preventDefault();
  11. }
  12. });
  13. });
 

HTML

  1. <div id="error_message" style="left: 50%; margin-left: -50px; display:none; position: absolute; width:100px; text-align:center; padding:20px; background-color:Yellow; color:Red;"></div>
 
0
0
498