瀏覽代碼

add js and css features

Entony 7 年之前
父節點
當前提交
eacfc39631
共有 10 個文件被更改,包括 104 次插入16 次删除
  1. 1 1
      css/style.css
  2. 1 1
      css/style.css.map
  3. 23 9
      css/style.scss
  4. 二進制
      img/combo1.jpg
  5. 二進制
      img/combo2.jpg
  6. 二進制
      img/combo3.jpg
  7. 二進制
      img/combo4.jpg
  8. 二進制
      img/icon_top.png
  9. 4 3
      index.html
  10. 75 2
      js/script.js

文件差異過大導致無法顯示
+ 1 - 1
css/style.css


文件差異過大導致無法顯示
+ 1 - 1
css/style.css.map


+ 23 - 9
css/style.scss

@@ -66,10 +66,7 @@ img {
 }
 header {
 	&.slider {
-		background : url(../img/combo.jpg) no-repeat;
-		background-color: rgba(0,0,0,0.3);
-		background-blend-mode: multiply;
-		background-position: center;
+		transition: 1s;
 	}
 	div.shadowslider {
 		background-color: rgba(0,0,0,0.6);
@@ -508,9 +505,26 @@ footer {
 	text-align: center;
 	font-size: 1.2rem;
 }
+.scrollup {
+	width:40px;
+	height:40px;
+	opacity:0.3;
+	position:fixed;
+	bottom:50px;
+	left: 10px;
+	display:none;
+	text-indent:-9999px;
+	background: url(../img/icon_top.png) no-repeat;
+}
 //---------------------------------------------
-// @media screen and (orientation: portrait) {
-//    	div.header-logo {
-//    		display: none;
-//    	}
-// }
+@media screen and (orientation: portrait) {
+	/* body {
+		display: none
+	} */
+   	div.header-logo {
+   		display: none;
+   	}
+   	header section.content .arrow {
+   		display: none;
+   	}
+}

二進制
img/combo1.jpg


二進制
img/combo2.jpg


二進制
img/combo3.jpg


二進制
img/combo4.jpg


二進制
img/icon_top.png


+ 4 - 3
index.html

@@ -10,7 +10,7 @@
 	<link rel="stylesheet" href="css/style.css">
 </head>
 <body>
-	<header class="slider">
+	<header id="bg" class="slider">
 		<div class="shadowslider">
 			<section class="content">
 				<div class="header-logo">
@@ -40,9 +40,9 @@
 					<img src="img/scales.png" alt="">
 				</div>
 			<div class="arrow">
-				<a href="#"><img src="img/slider-arrow-left.png" alt=""></a>
+				<a href="#" id="change-bg-previous"><img src="img/slider-arrow-left.png" alt=""></a>
 				<h1>Дизайнерские шторы для Вашего уюта</h1>
-				<a href="#"><img src="img/slider-arrow-rigth.png" alt=""></a>
+				<a href="#" id="change-bg-next"><img src="img/slider-arrow-rigth.png" alt=""></a>
 			</div>
 			<div class="button">	
 				<a href="#">Смотреть тренды</a>
@@ -323,6 +323,7 @@
 		</section>
 	</footer>
 
+<a href="#" class="scrollup">Наверх</a>
 	<script src="lib/jquery/dist/jquery.min.js"></script>
 	<script src="js/script.js"></script>
 </body>

+ 75 - 2
js/script.js

@@ -1,6 +1,58 @@
 var $positionAbsolute = $('#absolute').addClass('hide');
-
 var $item = $('.hide-button').data('counter', 1);
+var $changeBgPreviosly = $('#change-bg-previous');
+var $changeBgNext = $('#change-bg-next');
+
+var arr = [
+		{
+	'background': 'url(img/combo.jpg)',
+	'background-color': 'rgba(0,0,0,0.3)',
+	'background-blend-mode': 'multiply',
+	'background-position': 'center',
+	'background-repeat': 'no-repeat'
+	},
+		{
+	'background': 'url(img/combo1.jpg)',
+	'background-color': 'rgba(0,0,0,0.3)',
+	'background-blend-mode': 'multiply',
+	'background-position': 'center',
+	'background-repeat': 'no-repeat'
+	},
+		{
+	'background': 'url(img/combo2.jpg)',
+	'background-color': 'rgba(0,0,0,0.3)',
+	'background-blend-mode': 'multiply',
+	'background-position': 'center',
+	'background-repeat': 'no-repeat'
+	},
+		{
+	'background': 'url(img/combo3.jpg)',
+	'background-color': 'rgba(0,0,0,0.3)',
+	'background-blend-mode': 'multiply',
+	'background-position': 'center',
+	'background-repeat': 'no-repeat'
+	},
+		{
+	'background': 'url(img/combo4.jpg)',
+	'background-color': 'rgba(0,0,0,0.3)',
+	'background-blend-mode': 'multiply',
+	'background-position': 'center',
+	'background-repeat': 'no-repeat'
+	},
+		{
+	'background': 'url(img/combo.jpg)',
+	'background-color': 'rgba(0,0,0,0.3)',
+	'background-blend-mode': 'multiply',
+	'background-position': 'center',
+	'background-repeat': 'no-repeat'
+	},
+];
+
+var $background = $('#bg').css(arr[0]);
+var carousel = setInterval(function() {
+	$background.css(arr[ Math.floor((Math.random() * 5) + 1) ]);
+}, 8000);
+
 
 $item.on('click', function(event) {
 	event.preventDefault();
@@ -11,4 +63,25 @@ $item.on('click', function(event) {
 	if (counter !== 0) {
 		$positionAbsolute.removeClass('hide').addClass('show').text(counter);
 	}
-})
+});
+
+$changeBgPreviosly.on('click', function(){
+	event.preventDefault();
+	$background.css(arr[ Math.floor((Math.random() * 5) + 1) ]);
+});
+
+$changeBgNext.on('click', function(){
+	event.preventDefault();
+	$background.css(arr[ Math.floor((Math.random() * 5) + 1) ]);
+});
+
+$(window).scroll(function(){
+	if ($(this).scrollTop() > 200) {
+		$('.scrollup').fadeIn();
+	} else {
+		$('.scrollup').fadeOut();
+	}
+});
+ $('.scrollup').click(function(){
+	$("html, body").animate({ scrollTop: 0 }, 600);
+});