Форум: Форум PHPФорум ApacheФорум Регулярные ВыраженияФорум MySQLHTML+CSS+JavaScriptФорум FlashРазное
Новые темы: 0000000
PHP 5/6. В подлиннике. Авторы: Кузнецов М.В., Симдянов И.В. C++. Мастер-класс в задачах и примерах. Авторы: Кузнецов М.В., Симдянов И.В. Объектно-ориентированное программирование на PHP. Авторы: Кузнецов М.В., Симдянов И.В. Самоучитель MySQL 5. Авторы: Кузнецов М.В., Симдянов И.В. PHP. Практика создания Web-сайтов (второе издание). Авторы: Кузнецов М.В., Симдянов И.В.
ВСЕ НАШИ КНИГИ
Консультационный центр SoftTime

HTML+CSS+JavaScript

Выбрать другой форум

 

Здравствуйте, Посетитель!

вид форума:
Линейный форум Структурный форум

тема: Скролер
 
 автор: makigo   (07.06.2012 в 16:05)   письмо автору
 
 

Нужен был скрипт для вертикального и горизонтального скролинга.Нашел для горизонтального. Так как не знаю javascript то написал что мог для левого и правого скролинга .
Неудивительно что не работает.Пожалуйста помогите решить проблему.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
$(function() {
    var elev   = $('#scrollv');
    var speedv = 45, scrollv = 5, scrollingv;
    
    $('#scroll-upv').mouseenter(function() {
        // Scroll the element up
        scrollingv = window.setInterval(function() {
            elev.scrollTop( elev.scrollTop() - scrollv );
        }, speedv);
    });
    
    $('#scroll-downv').mouseenter(function() {
        // Scroll the element down
        scrollingv = window.setInterval(function() {
            elev.scrollTop( elev.scrollTop() + scrollv );
        }, speedv);
    });
  
    $('#scroll-upv, #scroll-downv').bind({
        click: function(ev) {
            // Prevent the default click action
            ev.preventDefault();
        },
        mouseleave: function() {
            if (scrollingv) {
                window.clearInterval(scrollingv);
                scrollingv = false;
            }
        }
    });

<!-- Мой каракули -->
    var eleh   = $('#scrollh');
    var speedh = 45, scrollh = 5, scrollingh;
    
        $('#scroll-righth').mouseenter(function() {
        // Scroll the element right
        scrollingh = window.setInterval(function() {
            eleh.scrollRight( eleh.scrollRight() + scrollh );
        }, speedh);
    });
    
    $('#scroll-lefth').mouseenter(function() {
        // Scroll the element left
        scrollingh = window.setInterval(function() {
            eleh.scrollRight( eleh.scrollRight() - scrollh );
        }, speedh);
    });
 
    $('#scroll-toph, #scroll-bottomh').bind({
        click: function(eh) {
            // Prevent the default click action
            eh.preventDefault();
        },
        mouseleave: function() {
            if (scrollingh) {
                window.clearInterval(scrollingh);
                scrollingh = false;
            }
        }
    });

<!-- Мой каракули -->
    
});
</script>
<style type="text/css">
div#scrollv {
    width: 200px;
    height: 200px;
    overflow: hidden;
    padding: 4px;
    margin-bottom: 20px;
}

div#scrollh {
    width: 200px;
    height: 50px;
    overflow: hidden;
    padding: 4px;
    margin-left: 20px;
}

</style>
</head>
<body>
<a href="#" id="scroll-upv">Up</a>
<div id="scrollv">
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here<br /><br />
    Content here and more content here
</div>

<a href="#" id="scroll-downv">Down</a>

</br>
<a href="#" id="scroll-righth">Right</a>
<div id="scrollh">
    Content here and more content here    Content here and 
more content here    Content here and more content here   
  Content here and more content here    Content here and 
more content here    Content here and more content here    
 Content here and more content here    Content here and 
more content here    Content here and more content here   
  Content here and more content here    Content here and 
more content here    Content here and more content here    
 Content here and more content here    Content here and 
more content here    Content here and more content here   
  Content here and more content here    Content here and 
more content here    Content here and more content here    
 Content here and more content here    Content here and 
more content here    Content here and more content here    
 Content here and more content here    Content here and 
more content here    Content here and more content here    
 Content here and more content here    Content here and 
more content here    Content here and more content here    
 Content here and more content here    Content here and 
more content here    Content here and more content here    
 Content here and more content here    Content here and 
more content here    Content here and more content here    
 Content here and more content here    Content here and 
more content here    Content here and more content here   
  Content here and more content here    Content here and 
more content here    Content here and more content here 
</div>

<a href="#" id="scroll-lefth">Left</a>

</body>
</html>

Content here and more content here

  Ответить  
 
 автор: confirm   (07.06.2012 в 16:39)   письмо автору
 
   для: makigo   (07.06.2012 в 16:05)
 

http://demos.flesler.com/jquery/scrollTo/

  Ответить  
 
 автор: makigo   (07.06.2012 в 17:12)   письмо автору
 
   для: confirm   (07.06.2012 в 16:39)
 

Спасибо но мне нужен простой скрипт.

  Ответить  
 
 автор: confirm   (07.06.2012 в 17:23)   письмо автору
 
   для: makigo   (07.06.2012 в 17:12)
 

А в плагине, что есть что-то сложное?
Посмотрите его код, может тогда поймете какую несуразицу вы пишите.
Это для изучения.

  Ответить  
Rambler's Top100
вверх

Rambler's Top100 Яндекс.Метрика Яндекс цитирования