<!DOCTYPE html>
<html>
<head>
<style>
.box {
width: 500px;
}
.box__image {
width: 100%;
}
</style>
</head>
<body>
<div class="box">
<img src="http://www.newton.ac.uk/files/covers/968361.jpg"
data-hover-src="http://zoarchurch.co.uk/content/pages/uploaded_images/91.png"
class="box__image">
</div>
<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
$(function() {
$('.box__image').mouseover(function() {
var $this = $(this);
if (!$this.data('image_replaced')) {
$this.data('image_replaced', true);
var newSrc = $this.attr('data-hover-src');
$this.attr('src', newSrc);
}
});
});
</script>
</body>
</html>
$locationChangeSuccess
Broadcasted after a URL was changed.
The newState and oldState parameters may be defined only in HTML5 mode and when the browser supports the HTML5 History API.
Property names must be strings. This means that non-string objects cannot be used as keys in the object. Any non-string object, including a number, is typecasted into a string via the toString method.
/**
* Format number from 5251.25 to "5 251.25"
*
* @param num
* @returns {string}
*/
function numberFormat(num) {
if (!isFinite(num)) {
return num;
}
var parts = num.toString().split('.');
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
return parts.join('.');
}