Много снега на Блоггер

Здравствуйте! Искала для своего сайта украшение в виде снега. Нашла очень много вариантов. И решила все их собрать в одну статью, может кому то пригодятся. Вкусы у всех разные и кому то нравится снег мелкий, а другим крупные снежинки.
В основном все коды вставляются в Дизайн - Добавить Гаджет - HTML/JavaScript. Те что добавляются по-другому на сайт, я отмечу отдельно.
У меня были предыдущие статьи с кодами снежинок и снега, можно посмотреть и их.
https://inshabashka.blogspot.com/2018/12/dekor-dlya-novogo-goda-na-blogger-girlyandy.html
https://inshabashka.blogspot.com/2018/03/SHlejfy-kursora-myshki-na-Blogger.html
https://inshabashka.blogspot.com/2019/10/snezhinki-css-na-sajt.html

Снег и снежинки

1. Снег движется в противоположную сторону от курсора. Размеры снега - не крупные кружочки. Движение быстрое.
Снег и снежинки
<script type="text/javascript" src="http://all-blogspot.com/blog/js/snowstorm.js"></script>
2. Снег мелкий, редкий, еле заметный. Движется не слишком быстро.
Снег мелкий
<script type="text/javascript" src="https://uguide.ru/js/script/snowfall.min.js"></script>
3. Снег идёт из курсора-снежинки, при каждом его движении.
Снег идёт из курсора-снежинки
<script type="text/javascript" src="https://uguide.ru/js/script/snowcursor.min.js">  </script>  <style type="text/css">  body, a:hover {cursor: url(https://uguide.ru/js/script/snowcurser.cur), url(https://uguide.ru/js/script/snowcurser.png), auto !important;}  </style>
4. Редкие голубые снежинки. Двигаются плавно, медленно. Подходят для светлых и тёмных фонов. Гаджет нужно поставить как можно выше.
Редкие голубые снежинки
<script src="https://uguide.ru/js/script/ok4.js" type="text/javascript"></script>
5. Крупные снежинки. Летят быстро, снежинок много. Снежинки можно ставить свои. Есть выключатель снега. Код взят из https://all-blogspot.com. Поменяйте снежинку на свою дважды - выделила адреса снежинки в коде красным цветом.
<div onclick="stopsnow()" id="snow-start">Выкл. снег</div>
<script type="text/javascript">
  var snowsrc="http://all-blogspot.com/blog/img/snow.png";
  var no = 20;
  var log = 0;
  var hidesnowtime = 0;
  var snowdistance = "windowheight";

  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;

    function iecompattest(){
    return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
    }

  var dx, xp, yp; 
  var am, stx, sty;
  var i, doc_width = 800, doc_height = 600;

  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }

  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("")!= 1)? "http://all-blogspot.com/blog/img/snow.png" : snowsrc
  for (i = 0; i < no; ++ i) {
    dx[i] = 0;                     
    xp[i] = Math.random()*(doc_width-50);
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;   
    stx[i] = 0.02 + Math.random()/10;
    sty[i] = 0.7 + Math.random(); 
        if (ie4up||ns6up) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: fixed; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: fixed; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      }
    }
  }

  function snowIE_NS6() {
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
        doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }

    function hidesnow(){
        if (window.snowtimer) clearTimeout(snowtimer)
        for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden";
    }

if (ie4up||ns6up){
    snowIE_NS6();
        if (hidesnowtime>0)
        setTimeout("hidesnow()", hidesnowtime*1000);
        }
 function stopsnow(){
 if (log==0){
  for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden";
  no = 0;
  log = 1;
  document.getElementById('snow-start').innerHTML ='Вкл. снег';
  }
  else { log = 0; no = 20; for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="visible";
 document.getElementById('snow-start').innerHTML ='Выкл. снег';

  }

 }
</script>
<a id="copy" href=""></a>
<style>
#snow-start{
background: rgba(27, 25, 25, 0.4);
color: #fff;
display: inline-block;
width: 100px;
text-align: center;
cursor: pointer;
line-height: 25px;
position: fixed;
right: 0px;
top: 0px;
border-radius: 0px 0px 0px 9px;
}
#copy{
color: rgba(20, 16, 16, 0);
font-size: 7px;
position: fixed;
text-decoration: none;
top: 24px;
right: 2px;
}
</style>
6. Крупные снежинки, падают довольно быстро. Так же можно менять снежинки в коде на другие. Выделила ссылку на картинку в коде красным цветом.
Крупные снежинки, падают довольно быстро
<script type="text/javascript">
  var snowsrc="http://blogger4you.narod.ru/Kartinki/snow3.gif"
  var no = 15;
  var hidesnowtime = 20;
  var snowdistance = "windowheight";
  var ie4up = (document.all) ? 1 : 0;
  var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
 function iecompattest(){
 return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
 }
  var dx, xp, yp;    // coordinate and position variables
  var am, stx, sty;  // amplitude and step variables
  var i, doc_width = 800, doc_height = 600;
  if (ns6up) {
    doc_width = self.innerWidth;
    doc_height = self.innerHeight;
  } else if (ie4up) {
    doc_width = iecompattest().clientWidth;
    doc_height = iecompattest().clientHeight;
  }
  dx = new Array();
  xp = new Array();
  yp = new Array();
  am = new Array();
  stx = new Array();
  sty = new Array();
  snowsrc=(snowsrc.indexOf("dynamicdrive.com")!=-1)? "snow.gif" : snowsrc
  for (i = 0; i < no; ++ i) {
    dx[i] = 0;                        // set coordinate variables
    xp[i] = Math.random()*(doc_width-50);  // set position variables
    yp[i] = Math.random()*doc_height;
    am[i] = Math.random()*20;         // set amplitude variables
    stx[i] = 0.02 + Math.random()/10; // set step variables
    sty[i] = 0.7 + Math.random();     // set step variables
  if (ie4up||ns6up) {
      if (i == 0) {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      } else {
        document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+snowsrc+"' border=\"0\"><\/div>");
      }
    }
  }
  function snowIE_NS6() {  // IE and NS6 main animation function
    doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
  doc_height=(window.innerHeight && snowdistance=="windowheight")? window.innerHeight : (ie4up && snowdistance=="windowheight")?  iecompattest().clientHeight : (ie4up && !window.opera && snowdistance=="pageheight")? iecompattest().scrollHeight : iecompattest().offsetHeight;
    for (i = 0; i < no; ++ i) {  // iterate for every dot
      yp[i] += sty[i];
      if (yp[i] > doc_height-50) {
        xp[i] = Math.random()*(doc_width-am[i]-30);
        yp[i] = 0;
        stx[i] = 0.02 + Math.random()/10;
        sty[i] = 0.7 + Math.random();
      }
      dx[i] += stx[i];
      document.getElementById("dot"+i).style.top=yp[i]+"px";
      document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i])+"px";
    }
    snowtimer=setTimeout("snowIE_NS6()", 10);
  }
 function hidesnow(){
  if (window.snowtimer) clearTimeout(snowtimer)
  for (i=0; i<no; i++) document.getElementById("dot"+i).style.visibility="hidden"
 }
if (ie4up||ns6up){
    snowIE_NS6();
  if (hidesnowtime>0)
  setTimeout("hidesnow()", hidesnowtime*1000)
  }
</script>
7. Разного размера снежки, код можно настроить. Вставляем в шаблон: Тема - Изменить XTML. Код вставляем перед </head>. Выделенное красным можно менять на свои параметры.
  • flakeCount - количество снежинок
  • flakeColor - цвет снежинок
  • flakeIndex - индекс
  • minSize - минимальный размер снежинки
  • maxSize - максимальный размер снежинки
  • minSpeed - минимальная скорость падения
  • maxSpeed - максимальная скорость падения
  • round - true или false - делает снежинки округлыми
  • pshadow - true или false - придаёт тень
Если jQuery уже был добавлен в ваш шаблон раньше, то выделенные синим строки из кода удалите.
снежинки
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js' type='text/javascript'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/1.4.1/jquery-migrate.min.js' type='text/javascript'></script>

<script src='https://cdnjs.cloudflare.com/ajax/libs/JQuery-Snowfall/1.7.4/snowfall.jquery.min.js' type='text/javascript'></script>
<script type='text/javascript'>
//<![CDATA[
jQuery(document).ready(function($) {
 $(document).snowfall({
 flakeCount : 400,
 flakeColor : "#ffffff",
 flakeIndex: 999999,
 minSize : 1,
 maxSize : 4,
 minSpeed : 2,
 maxSpeed : 8,
 round : true,
 shadow : false,
 });
});
//]]>
</script>
8. Снежинки на css - небольшие, порхают медленно по экрану. Лёгкий код, не тормозит блог. Вставляем в гаджет в любом месте блога. Можно добавить снежинки или удалить лишние.
Снежинки на css
<div class="snowflakes" aria-hidden="true">
  <div class="snowflake">
  ❅
  </div>
  <div class="snowflake">
  ❅
  </div>
  <div class="snowflake">
  ❆
  </div>
  <div class="snowflake">
  ❄
  </div>
  <div class="snowflake">
  ❅
  </div>
  <div class="snowflake">
  ❆
  </div>
  <div class="snowflake">
  ❄
  </div>
  <div class="snowflake">
  ❅
  </div>
  <div class="snowflake">
  ❆
  </div>
  <div class="snowflake">
  ❄
  </div>
</div>
<style>
.snowflake {
  color: #fff;
  font-size: 1em;
  font-family: Arial;
  text-shadow: 0 0 1px #000;
}
@-webkit-keyframes snowflakes-fall{0%{top:-10%}100%{top:100%}}@-webkit-keyframes snowflakes-shake{0%{-webkit-transform:translateX(0px);transform:translateX(0px)}50%{-webkit-transform:translateX(80px);transform:translateX(80px)}100%{-webkit-transform:translateX(0px);transform:translateX(0px)}}@keyframes snowflakes-fall{0%{top:-10%}100%{top:100%}}@keyframes snowflakes-shake{0%{transform:translateX(0px)}50%{transform:translateX(80px)}100%{transform:translateX(0px)}}.snowflake{position:fixed;top:-10%;z-index:9999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default;-webkit-animation-name:snowflakes-fall,snowflakes-shake;-webkit-animation-duration:10s,3s;-webkit-animation-timing-function:linear,ease-in-out;-webkit-animation-iteration-count:infinite,infinite;-webkit-animation-play-state:running,running;animation-name:snowflakes-fall,snowflakes-shake;animation-duration:10s,3s;animation-timing-function:linear,ease-in-out;animation-iteration-count:infinite,infinite;animation-play-state:running,running}.snowflake:nth-of-type(0){left:1%;-webkit-animation-delay:0s,0s;animation-delay:0s,0s}.snowflake:nth-of-type(1){left:10%;-webkit-animation-delay:1s,1s;animation-delay:1s,1s}.snowflake:nth-of-type(2){left:20%;-webkit-animation-delay:6s,.5s;animation-delay:6s,.5s}.snowflake:nth-of-type(3){left:30%;-webkit-animation-delay:4s,2s;animation-delay:4s,2s}.snowflake:nth-of-type(4){left:40%;-webkit-animation-delay:2s,2s;animation-delay:2s,2s}.snowflake:nth-of-type(5){left:50%;-webkit-animation-delay:8s,3s;animation-delay:8s,3s}.snowflake:nth-of-type(6){left:60%;-webkit-animation-delay:6s,2s;animation-delay:6s,2s}.snowflake:nth-of-type(7){left:70%;-webkit-animation-delay:2.5s,1s;animation-delay:2.5s,1s}.snowflake:nth-of-type(8){left:80%;-webkit-animation-delay:1s,0s;animation-delay:1s,0s}.snowflake:nth-of-type(9){left:90%;-webkit-animation-delay:3s,1.5s;animation-delay:3s,1.5s}
.demo {
  font-family: 'Raleway', sans-serif;
    color:#fff;
    display: block;
    margin: 0 auto;
    padding: 15px 0;
    text-align: center;
}
.demo a{
  font-family: 'Raleway', sans-serif;
color: #000;
}
</style>
В статье я представила те снежинки, что встали у меня на блог.

Ваши комментарии:

Комментарии со спамом удаляются.