


Display left and right arrows on pictures similar to page turning code_javascript skills
May 16, 2016 pm 05:41 PMUse JS to implement the page turning code that displays the left and right arrows on the picture. The preview URL is: http://www.keleyi.com/keleyi/phtml/picnext/
This example uses the onmousemove event of javascript. The onmousemove event occurs when the mouse pointer moves.
Syntax
onmousemove="SomeJavaScriptCode"
SomeJavaScriptCode is a required parameter. Specifies the JavaScript to be executed when this event occurs.
The following is the core code (please view the source code on the effect page for the complete code):
<script type="text/javascript">
function KeleyiImgNext(bigimg) {
var lefturl = "01.html";
var righturl ="03.html";
var imgurl = righturl;
var width = bigimg.width;
var height = bigimg.height;
bigimg.onmousedown = bigimg.onmousemove = function () {
if (event.offsetX < width / 2) {
imgurl = lefturl;
if (imgurl != "#")
bigimg.style.cursor = 'url( images/arr_left.cur),auto';
else
bigimg.style.cursor = 'default';
} else {
imgurl = righturl;
if (imgurl != '# ')
bigimg.style.cursor = 'url(images/arr_right.cur),auto';
else
bigimg.style.cursor = 'default';
}
}
bigimg.onmouseup = function () {
if (imgurl != '#')
top.location = imgurl;
}
}
</script>
<img onmouseover="KeleyiImgNext(this)" src="http://www.keleyi.com/keleyi/phtml/picnext/images/k02.jpg" alt="keleyi" />

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Replace String Characters in JavaScript

Custom Google Search API Setup Tutorial

8 Stunning jQuery Page Layout Plugins

Improve Your jQuery Knowledge with the Source Viewer

10 Mobile Cheat Sheets for Mobile Development
