Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitefb3ceb

Browse files
committed
minimize and organize custom js
1 parent1cd92dd commitefb3ceb

File tree

9 files changed

+62
-63
lines changed

9 files changed

+62
-63
lines changed

‎_includes/base/scripts.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
<!-- Scripts -->
2-
<scriptsrc="//cdnjs.cloudflare.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
2+
<scriptsrc="//cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
33

44
<scriptsrc="{{" /js/lib/jquery.scrollex.min.js " | prepend: site.baseurl }}"></script>
55
<scriptsrc="{{" /js/lib/jquery.scrolly.min.js " | prepend: site.baseurl }}"></script>
66
<scriptsrc="{{" /js/lib/skel.min.js " | prepend: site.baseurl }}"></script>
77
<scriptsrc="{{" /js/lib/animatedModal.min.js " | prepend: site.baseurl }}"></script>
88
<scriptsrc="{{" /js/lib/util.min.js " | prepend: site.baseurl }}"></script>
9-
<!--[if lte IE 8]><script src="{{ "/js/ie/respond.min.js" | prepend: site.baseurl }}"></script><![endif]-->
10-
<scriptsrc="{{" /js/main.min.js " | prepend: site.baseurl }}"></script>
11-
<scriptsrc="{{" /js/modals.min.js " | prepend: site.baseurl }}"></script>
129
<scriptsrc="{{" /js/lib/png2gif.min.js " | prepend: site.baseurl }}"></script>
1310
<scriptsrc="{{" /js/lib/jquery.lazyload.min.js " | prepend: site.baseurl }}"></script>
1411
<scriptsrc="{{" /js/lib/jquery.smoothscroll.min.js " | prepend: site.baseurl }}"></script>
15-
<scriptsrc="{{" /js/ga.min.js " | prepend: site.baseurl }}"></script>
12+
<!--[if lte IE 8]><script src="{{ "/js/ie/respond.min.js" | prepend: site.baseurl }}"></script><![endif]-->
13+
<scriptsrc="{{" /dist/build.min.js " | prepend: site.baseurl }}"></script>
14+
<scriptsrc="{{" /js/lib/ga.min.js " | prepend: site.baseurl }}"></script>

‎dist/build.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎gulpfile.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@ const gulp = require('gulp');
22
constuglify=require('gulp-uglify');
33
constpump=require('pump');
44
constconcat=require('gulp-concat');
5+
constsass=require('gulp-sass');
56

67
gulp.task('compress',function(cb){
78
pump([
89
gulp.src([
9-
'js/lib/jquery.scrollex.min.js',
10-
'js/lib/jquery.scrolly.min.js',
11-
'js/lib/skel.min.js',
12-
'js/lib/util.min.js',
13-
'js/lib/*.js',
1410
'js/*.js'
1511
]),
1612
concat('build.min.js'),
@@ -21,6 +17,10 @@ gulp.task('compress', function (cb) {
2117
);
2218
});
2319

24-
20+
gulp.task('sass',function(){
21+
returngulp.src('./_sass/main.scss')
22+
.pipe(sass().on('error',sass.logError))
23+
.pipe(gulp.dest('./dist'));
24+
});
2525

2626
gulp.task('default',['compress','sass']);

‎js/images.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
$(function(){
2+
// images
3+
$("img.lazy").lazyload({
4+
effect:"fadeIn",
5+
threshold :200,
6+
});
7+
});
File renamed without changes.

‎js/main.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎js/modals.js

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,53 +16,4 @@ $(function() {
1616
.attr("src","images/demos/builder-demo.gif");
1717
}
1818
});
19-
20-
// images
21-
$("img.lazy").lazyload({
22-
effect:"fadeIn",
23-
threshold :200,
24-
});
25-
26-
// smooth scroll
27-
$('a.smooth').smoothScroll({
28-
offset:-70,
29-
direction:'top',
30-
easing:'swing',
31-
speed:400,
32-
autoCoefficient:2,
33-
preventDefault:true
34-
});
35-
36-
37-
constscrollnow=function(e){
38-
vartarget;
39-
if(e){
40-
e.preventDefault();
41-
target=this.hash;
42-
}else{
43-
target=location.hash;
44-
}
45-
$.smoothScroll({
46-
offset:-70,
47-
easing:'swing',
48-
speed:400,
49-
autoCoefficient:2,
50-
preventDefault:true,
51-
scrollTarget:target
52-
});
53-
};
54-
55-
if(location.hash){
56-
$('html, body').scrollTop(0).show();
57-
scrollnow();
58-
}
59-
60-
$('a[href*="/"][href*=#]').each(function(){
61-
if(this.pathname.replace(/^\//,'')==location.pathname.replace(/^\//,'')&&this.hostname==location.hostname){
62-
$(this).attr("href",this.hash);
63-
}
64-
});
65-
66-
$('a[href^=#]:not([href=#])').click(scrollnow);
67-
6819
});

‎js/modals.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

‎js/scroll.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
$(function(){
2+
// smooth scroll
3+
$('a.smooth').smoothScroll({
4+
offset:-70,
5+
direction:'top',
6+
easing:'swing',
7+
speed:400,
8+
autoCoefficient:2,
9+
preventDefault:true
10+
});
11+
12+
13+
constscrollnow=function(e){
14+
vartarget;
15+
if(e){
16+
e.preventDefault();
17+
target=this.hash;
18+
}else{
19+
target=location.hash;
20+
}
21+
$.smoothScroll({
22+
offset:-70,
23+
easing:'swing',
24+
speed:400,
25+
autoCoefficient:2,
26+
preventDefault:true,
27+
scrollTarget:target
28+
});
29+
};
30+
31+
if(location.hash){
32+
$('html, body').scrollTop(0).show();
33+
scrollnow();
34+
}
35+
36+
$('a[href*="/"][href*=\\#]').each(function(){
37+
if(this.pathname.replace(/^\//,'')==location.pathname.replace(/^\//,'')&&this.hostname==location.hostname){
38+
$(this).attr("href",this.hash);
39+
}
40+
});
41+
42+
$('a[href^=#]:not([href=#])').click(scrollnow);
43+
44+
});

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp