Показать сообщение отдельно
  #17 (permalink)  
Старый 17.03.2015, 14:20
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,075

Запуск gif при видимости на экране
6323705,

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title> - jsFiddle demo</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdn.rawgit.com/dirkgroenen/jQuery-viewport-checker/1.7.4/src/jquery.viewportchecker.js"></script>
<script>
jQuery(document).ready(function() {
    jQuery('.chart2 img').viewportChecker({
        classToAdd: 'animated fadeIn',
        offset: 100,
         repeat: true,
        callbackFunction: function(elem, action) {
            elem[0].src = action == 'add' ? 'http://fufel.info/uploads/posts/2014-04/1396388286_gifs_020.gif' : '';
        }
    });
})
</script>


<style type='text/css'>
    .chart2 img{
      height: 200px;
    }

</style>
</head>
<body>
  <div class="chart2 animated" id="chartContainerPie2" style="margin-top:1200px;height: 300px; float: left;width: 60%;">
  <img src="" alt=""></div>
</body>
</html>

Последний раз редактировалось рони, 17.03.2015 в 14:22.
Ответить с цитированием