|
|
|
| Нужен был скрипт для вертикального и горизонтального скролинга.Нашел для горизонтального. Так как не знаю 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 в 17:12)
| | А в плагине, что есть что-то сложное?
Посмотрите его код, может тогда поймете какую несуразицу вы пишите.
Это для изучения. | |
|
|
|