1
Fork 0
This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
theorangeone.net-legacy/static/src/js/app.js

26 lines
934 B
JavaScript
Raw Normal View History

2015-11-23 18:46:11 +00:00
/* global $ */
2015-10-19 13:04:49 +01:00
var React = require('react');
var ProjectImagesTypes = require('./components/project-images-types');
2015-11-23 18:27:53 +00:00
var ProjectImagesMain = require('./components/project-images-main');
2015-11-11 16:32:51 +00:00
$(function() { // https://css-tricks.com/snippets/jquery/smooth-scrolling/
$('a[href*=#]:not([href=#])').click(function() {
2015-11-23 18:46:11 +00:00
if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '')
&& location.hostname === this.hostname) {
2015-11-11 16:32:51 +00:00
var target = $(this.hash);
2015-11-23 18:46:11 +00:00
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
2015-11-11 16:32:51 +00:00
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
2015-11-10 23:24:28 +00:00
if ($('body').hasClass('index')) {
React.render(<ProjectImagesTypes />, document.getElementById('project-images-types'));
React.render(<ProjectImagesMain />, document.getElementById('project-images-main'));
}