<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>华为智能门锁</title>
		<link rel="stylesheet" href="css/main.css">
		<style>
		</style>
		<script src="js/jQuery_file.js"></script>
		<script type="text/javascript">
			//6,加减数量
			$(function(){
				$("#count_add").click(function(){
					var index=$("#product_count").val();
					index++;
					if(index>=10){
						index=10;
					}
					$("#product_count").val(index);
				});
				$("#count_minus").click(function(){
					var index=$("#product_count").val();
					index--;
					if(index<=0){
						index=1;
					}
					$("#product_count").val(index);
				})
			})
<pre><code>	//第二题点击不同颜色选项
					// 获取颜色选项的元素
						var colorOptions = document.querySelectorAll(&quot;.color .item&quot;);
					
						// 为每个颜色选项添加点击事件监听器
						colorOptions.forEach(function(option) {
							option.addEventListener(&quot;click&quot;, function() {
							// a) 选中当前颜色选项,其余选项恢复正常
							colorOptions.forEach(function(item) {
								if (item === option) {
									item.classList.add(&quot;selected&quot;);
								} else {
									item.classList.remove(&quot;selected&quot;);
								}
							});
						
							// b) 清空页面左侧产品图片列表,并加载对应颜色的所有产品图片
							var photoList = document.querySelector(&quot;#scroll ul&quot;);
							photoList.innerHTML = &quot;&quot;; // 清空图片列表
						
							// 加载对应颜色的所有产品图片
							var jsonData = {
								&quot;星际黑&quot;: [&quot;img/a01.png&quot;, &quot;img/a02.png&quot;, &quot;img/a03.png&quot;],
								&quot;鎏光金&quot;: [&quot;img/b01.png&quot;, &quot;img/b02.png&quot;, &quot;img/b03.png&quot;]
								// 其他颜色的图片数据...
							};
						
							var selectedColor = option.textContent.trim();
							var colorPhotos = jsonData[selectedColor];
							colorPhotos.forEach(function(photo) { // 修改变量名称为photo
								var li = document.createElement(&quot;li&quot;);
								var img = document.createElement(&quot;img&quot;);
								img.src = photo;
								li.appendChild(img);
								photoList.appendChild(li);
							});
						
							// c) 左侧上方大图默认显示第一张产品图片
							var firstPhoto = colorPhotos[0];
							var mainPhoto = document.querySelector(&quot;#photo_pannel .photo img&quot;);
							mainPhoto.src = firstPhoto;
						});
						});
		&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div id=&quot;nav_panel&quot;&gt;
		&lt;div class=&quot;nav&quot;&gt;&lt;img src=&quot;img/top.png&quot; alt=&quot;&quot;&gt;&lt;/div&gt;
	&lt;/div&gt;
	&lt;div class=&quot;position&quot;&gt;
		&lt;a href=&quot;&quot; title=&quot;首页&quot;&gt;首页&lt;/a&gt;
		&amp;gt;
		&lt;a href=&quot;&quot; title=&quot;智能家装&quot;&gt;智能家装&lt;/a&gt;
		&amp;gt;
		&lt;a href=&quot;&quot; title=&quot;智能门锁&quot;&gt;智能门锁&lt;/a&gt;
		&amp;gt;
		&lt;a id=&quot;product_title&quot; href=&quot;&quot; title=&quot;智能门锁 标准版&quot;&gt;智能门锁 标准版&lt;/a&gt;			
	&lt;/div&gt;
	&lt;div class=&quot;main&quot;&gt;
		&lt;div id=&quot;photo_pannel&quot;&gt;
			&lt;div class=&quot;photo&quot;&gt;&lt;img src=&quot;img/a01.png&quot; alt=&quot;&quot;&gt;&lt;/div&gt;
			&lt;div class=&quot;photo_list&quot;&gt;
				&lt;div class=&quot;prev tab&quot;&gt;&lt;img src=&quot;img/disabled-prev.png&quot; alt=&quot;&quot;&gt;&lt;/div&gt;
				&lt;div id=&quot;scroll&quot;&gt;
					&lt;ul&gt;
						&lt;li&gt;&lt;img src=&quot;img/a01.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
						&lt;li&gt;&lt;img src=&quot;img/a02.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
						&lt;li&gt;&lt;img src=&quot;img/a03.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
						&lt;li&gt;&lt;img src=&quot;img/a04.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
						&lt;li&gt;&lt;img src=&quot;img/a05.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
						&lt;li&gt;&lt;img src=&quot;img/a06.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
						&lt;li&gt;&lt;img src=&quot;img/a07.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
						&lt;li&gt;&lt;img src=&quot;img/a08.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
						&lt;li&gt;&lt;img src=&quot;img/a09.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
						&lt;li&gt;&lt;img src=&quot;img/a10.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
						&lt;li&gt;&lt;img src=&quot;img/a11.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
						&lt;li&gt;&lt;img src=&quot;img/a12.png&quot; alt=&quot;&quot;&gt;&lt;/li&gt;
					&lt;/ul&gt;
				&lt;/div&gt;
				&lt;div class=&quot;next tab&quot;&gt;&lt;img src=&quot;img/hover-next.png&quot; alt=&quot;&quot;&gt;&lt;/div&gt;
			&lt;/div&gt;
		&lt;/div&gt;
		&lt;div id=&quot;property_pannel&quot;&gt;
			&lt;div class=&quot;title&quot;&gt;华为智能门锁 标准版&lt;/div&gt;
			&lt;div class=&quot;desc&quot;&gt;AI指纹锁,华为手机钱包钥匙开锁,HarmonyOS分布式猫眼,8800mAh超大容量电池&lt;/div&gt;
			&lt;div class=&quot;price&quot;&gt;¥&lt;span&gt;2799&lt;/span&gt;&lt;/div&gt;
			&lt;div class=&quot;hot&quot;&gt;智能门锁系列:&lt;span&gt;拼团最高省500&lt;/span&gt;&lt;div&gt;&amp;gt;&lt;/div&gt;&lt;/div&gt;
			&lt;div class=&quot;color choose_outer&quot; id=&quot;color_panel&quot;&gt;
				&lt;div class=&quot;title&quot;&gt;颜色&lt;/div&gt;
				&lt;div class=&quot;choose&quot;&gt;
					&lt;div class=&quot;item black&quot;&gt;星际黑&lt;/div&gt;
					&lt;div class=&quot;item gold selected&quot;&gt;鎏光金&lt;/div&gt;
				&lt;/div&gt;
			&lt;/div&gt;
			&lt;div class=&quot;type choose_outer&quot; id=&quot;version_panel&quot;&gt;
				&lt;div class=&quot;title&quot;&gt;版本&lt;/div&gt;
				&lt;div class=&quot;choose&quot;&gt;
					&lt;div class=&quot;item&quot;&gt;Pro 版&lt;br&gt;比如&gt;3D人脸识别+可视猫眼+指纹解锁&lt;/div&gt;
					&lt;div class=&quot;item&quot;&gt;标准版&lt;br&gt;可视猫眼+指纹解锁&lt;/div&gt;
				&lt;/div&gt;
			&lt;/div&gt;
			&lt;div class=&quot;service choose_outer&quot;&gt;
				&lt;div class=&quot;title&quot;&gt;保障服务&lt;/div&gt;
				&lt;div class=&quot;desc&quot;&gt;已有590万位用户加入华为官方保障服务&lt;/div&gt;
			&lt;/div&gt;
			&lt;div id=&quot;order_panel&quot;&gt;
				&lt;div class=&quot;count&quot;&gt;
					&lt;div class=&quot;count_op&quot; id=&quot;count_minus&quot;&gt;
						&lt;img src=&quot;img/minus.png&quot; alt=&quot;&quot;&gt;&lt;/div&gt;
						&lt;input type=&quot;text&quot; name=&quot;&quot; id=&quot;product_count&quot; value=&quot;1&quot;&gt;
						&lt;div class=&quot;count_op&quot; id=&quot;count_add&quot;&gt;
							&lt;img src=&quot;img/add.png&quot; alt=&quot;&quot;&gt;
						&lt;/div&gt;&lt;/div&gt;
				&lt;button class=&quot;add&quot;&gt;加入购物车&lt;/button&gt;
				&lt;button class=&quot;buy&quot;&gt;立刻购买&lt;/button&gt;
			&lt;/div&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/body&gt;
</code></pre>
</html>
华为智能门锁标准版 - AI指纹锁,手机钱包钥匙开锁,HarmonyOS猫眼

原文地址: https://www.cveoy.top/t/topic/pB8x 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录