Skip to content

Commit e5bec54

Browse files
committed
css3: transition
1 parent 93bdf6f commit e5bec54

File tree

10 files changed

+186
-6
lines changed

10 files changed

+186
-6
lines changed

closure/a.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Created by google on 16-10-27.
3+
*/
4+
5+
'use strict';
6+
7+
let test=function () {
8+
console.log(1111);
9+
}
10+
11+
12+
exports.test=test;

closure/b.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/**
2+
* Created by google on 16-10-27.
3+
*/
4+
5+
'use strict';
6+
7+
8+
let test=function () {
9+
console.log(1111);
10+
}
11+
12+
13+
module.exports={
14+
test:test
15+
}

closure/index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Created by google on 16-10-27.
3+
*/
4+
5+
'use strict';
6+
7+
let a;
8+
9+
function test(temp) {
10+
a = temp;
11+
setInterval(function () {
12+
console.log(a);
13+
},1000)
14+
}
15+
16+
17+
exports.test = test;

closure/main.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* Created by google on 16-10-27.
3+
*/
4+
5+
'use strict';
6+
7+
let aaa=require('./a').test;
8+
9+
let bb=require('./b');
10+
11+
12+
aaa();
13+
// console.log(22);
14+

coffee/a.coffee

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
resizePages = (target, animate = true) -> # TODO: use target to target specific DOMs to transform - teng
2+
logger.log "[FRESH] Resize pages"
3+
4+
smallScreen = DeviceHelper.isSmallScreen
5+
header = $('#header-container')
6+
headerSpacer = $('#header-spacer')
7+
8+
# header.after headerSpacer # Important for v4 - header spacer must be moved out of header-container
9+
10+
# Account for nav logo height on first page
11+
if navAnimation()
12+
hh = header.height() - 0
13+
headerSpacer.show().css('height', hh)
14+
logoHeight = $('#header-container .logo').height()
15+
$('a.section-anchor').css('top',-hh+logoHeight+20)
16+
$('a.section-anchor').first().css('top',-hh)
17+
###
18+
if spacer.length == 0
19+
spacer = $('<div class="spacer"></div>').prependTo( $('li.slide .container').first() )
20+
hh = header.height() - 20
21+
###
22+
else
23+
headerSpacer.hide()
24+
25+
# BG editor on first slide
26+
# fixBgEditor()
27+
28+
height = $(window).height()
29+
# if smallScreen
30+
# height = if h < 640 then 640 else h
31+
32+
# Resize first section to fill the height of the screen
33+
logger.log "[FRESH]: Resizing sections"
34+
$('.s-title-section, li.slide:first-child .s-cta-section, li.slide:first-child .s-slider-section').each (i, el) ->
35+
t = $(this); c = t.find('.container').first()
36+
if t.hasClass 'no-resize' # This might appear here from containBackgroundImages
37+
this.style.paddingTop = ''
38+
this.style.paddingBottom = ''
39+
else
40+
# Reset inline padding in order to calculate original padding from stylesheet
41+
inlinePaddingTop = this.style.paddingTop
42+
inlinePaddingBottom = this.style.paddingBottom
43+
this.style.paddingTop = ''
44+
this.style.paddingBottom = ''
45+
# Ignore if the original (aka natural) padding is >100
46+
origPaddingTop = Math.min(100, parseInt(t.css('padding-top'), 10))
47+
origPaddingBottom = Math.min(100, parseInt(t.css('padding-bottom'), 10))
48+
this.style.paddingTop = inlinePaddingTop
49+
this.style.paddingBottom = inlinePaddingBottom
50+
51+
# Fix slogan slide for first slide
52+
sectionHeight = height
53+
if i == 0 && t.closest('li.slide').is(':first-child')
54+
if smallScreen() then sectionHeight -= header.outerHeight()
55+
else if header.is(':visible') then sectionHeight -= header.height()
56+
else
57+
if header.is(':visible') then sectionHeight -= (header.height() - getLogoHeight())
58+
59+
# HACKY: defer it because somehow DOM is not ready
60+
window.setTimeout ->
61+
return if t.hasClass 'no-resize' # This might appear here from containBackgroundImages in the delay time
62+
63+
64+
if $(el).is('.s-slider-section')
65+
current = $(el).find('.iosslider').data('current')
66+
currentSlideHeight = $(el).find('.iosslider').find('.inner').get(current).outerHeight()
67+
if currentSlideHeight < sectionHeight
68+
$(el).find('.iosslider').height(sectionHeight).css('min-height', sectionHeight+"px")
69+
return
70+
71+
currentHeight = t.outerHeight()
72+
# Disable adjustment if on mobile and resize is small
73+
return if Math.abs(currentHeight - sectionHeight) < 64 && DeviceHelper.isSmallScreen()
74+
# Adjust section height
75+
pad = (sectionHeight-c.outerHeight(false)) * 0.5
76+
ptop = Math.max (Math.min 450, Math.floor(pad)), origPaddingTop
77+
pbottom = Math.max (Math.min 450, Math.ceil(pad)), origPaddingBottom
78+
newStyles =
79+
'padding-top': ptop
80+
'padding-bottom': pbottom
81+
if animate # e.g. on load, on resize
82+
t.stop().animate newStyles, 100
83+
else # e.g. on switch page before fade
84+
t.css newStyles

css/index.css

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
body{
22
color:red;
3-
}
3+
}
4+
5+
6+
.transition {
7+
width: 100px;
8+
height: 100px;
9+
background-color: #222222;
10+
transition: height 1.5s;
11+
}
12+
13+
.button1{
14+
width: 40px;
15+
height: 50px;
16+
}
17+

css/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
<meta charset="UTF-8">
55
<title>Title</title>
66
<link rel="stylesheet" type="text/css" href="index.css">
7+
<script src="//staticfile.qnssl.com/jquery/2.0.3/jquery.min.js"></script>
78

89

910
</head>
1011
<body>
11-
111
12+
<div class="transition"></div>
13+
<button class="button1"/>
1214
</body>
1315

1416
<script src="index.js"></script>

css/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,10 @@
33
*/
44

55

6-
console.log('load index.js');
6+
7+
8+
$( ".button1" ).click(function() {
9+
10+
$('.transition').height(200)
11+
12+
});

my-app/public/index.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,21 @@
1111
work correctly both     with client-side routing and a non-root public URL.
1212
Learn how to configure a non-root public URL by running `npm run build`.
1313
-->
14-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
1514
<title>React App</title>
15+
<script src="//staticfile.qnssl.com/jquery/2.0.3/jquery.min.js"></script>
16+
17+
<style>
18+
19+
20+
@media only screen and (max-width: 727px){
21+
22+
body h1{
23+
color:red;
24+
}
25+
26+
}
27+
28+
</style>
1629
</head>
1730
<body>
1831
<h1 style="height: 100px">我是h1</h1>

swiper/index.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@
7777
<div class="swiper-slide">Slide 10</div>
7878
</div>
7979
<!-- Add Pagination -->
80-
<div class="swiper-pagination"></div>
80+
81+
<div class="swiper-pagination center slide-selectors">
82+
83+
</div>
8184
</div>
8285

8386
<!-- Swiper JS -->
@@ -89,7 +92,7 @@
8992
pagination: '.swiper-pagination',
9093
paginationClickable: true,
9194
paginationBulletRender: function (index, className) {
92-
return '<span class="' + className + '">' + (index + 1) + '</span>';
95+
return '<span class="test ' + className + '">' + (index + 1) + '</span>';
9396
}
9497
});
9598
</script>

0 commit comments

Comments
 (0)