how2j.cn


15分13秒
本视频采用html5方式播放,如无法正常播放,请将浏览器升级至最新版本,推荐火狐,chrome,360浏览器 如果装有迅雷,播放视频呈现直接下载状态,请调整 迅雷系统设置-基本设置-启动-监视全部浏览器 (去掉这个选项)

步骤 1 : 效果   
步骤 2 : 布局   
步骤 3 : 纯html   
步骤 4 : 加上样式   
步骤 5 : 样式讲解   
步骤 6 : 再整合在一起   

步骤 1 :

效果

每种商品都有5个详细图片,而且这些图片都比较大。 为了加快显示的速度,讲解的时候,只使用一个图片。
"); window.frames["iframe_show3241"].document.write(decodeHtml($("textarea#stepcodeTextarea3241").val())); window.frames["iframe_show3241"].document.close(); $(window.frames["iframe_show3241"]).load(function(){ $("#iframe_show3241").height($("#iframe_show3241").contents().find("body").height()+showittryitheight); }); $("#iframe_show3241").height($("#iframe_show3241").contents().find("body").height()+showittryitheight); setTimeout(function(){ },500); });
<!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script src="http://127.0.0.1/study../../../js/jquery/2.0.0/jquery.min.js"></script> <link href="http://127.0.0.1/study../../../css/bootstrap/3.3.6/bootstrap.min.css" rel="stylesheet"> <script src="http://127.0.0.1/study../../../js/bootstrap/3.3.6/bootstrap.min.js"></script> </head> <style> div.productDetailDiv{ width: 790px; margin: 40px auto; } div.productDetailTopPart{ border: 1px solid #DFDFDF; border-left-width: 0px; } a.selected{ border-left: 1px solid #cfbfb1; border-right: 1px solid #cfbfb1; color: #b10000; display: inline-block; font-weight: bold; line-height: 46px; width: 90px; text-align: center; position: relative; } a.selected:before{ content:""; display: block; border-width: 1px; border-color: #b00000; border-style: solid; width: 90px; height: 0; position: absolute; top: -1px; margin-left: -1px; } a.selected:after{ content: ""; display: block; border-color: #b00000 transparent transparent; border-style: solid; border-width: 5px; width: 0; height: 0; position: absolute; top: -1px; left: 50%; margin-left: -5px; } a.productDetailTopReviewLink{ padding: 0px 20px; border-right: 1px dotted #D2D2D2; color: #333333; } span.productDetailTopReviewLinkNumber{ color: #3355B9; } div.productParamterPart{ border: 1px solid #DFDFDF; padding: 40px; } div.productParamter{ color: #999999; font-weight: bold; margin-bottom: 20px; } div.productParamterList span{ display: block; width: 220px; float: left; padding: 8px 0px; color: #666666; } div.productDetailImagesPart img{ display: block; width: 790px; margin:20px 0px; } body{ font-size: 12px; font-family: Arial; } a:hover{ text-decoration:none; color: #C40000; } </style> <div class="productDetailDiv" style="display: block;"> <div class="productDetailTopPart"> <a class="productDetailTopPartSelectedLink selected" href="#nowhere">商品详情</a> <a class="productDetailTopReviewLink" href="#nowhere">累计评价 <span class="productDetailTopReviewLinkNumber">19</span> </a> </div> <div class="productParamterPart"> <div class="productParamter">产品参数:</div> <div class="productParamterList"> <span>材质成分: 聚酯纤维100% </span> <span>品牌: Emyche/艾米秋 </span> <span>货号: 129668 </span> <span>尺码: L M S XL X </span> <span>上市年份季节: 2016年夏季 </span> <span>颜色分类: 白色 黑色 浅蓝 </span> <span>适用年龄: 18-25周岁 </span> </div> <div style="clear:both"></div> </div> <div class="productDetailImagesPart"> <img src="http://127.0.0.1/tmall/img/productDetail/8626.jpg"> </div> </div>
"); window.frames["iframe3241"].document.write(decodeHtml(code3241)); window.frames["iframe3241"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3241"]).load(function(){ $("#iframe3241").height($("#iframe3241").contents().find("body").height()+showittryitheight); }); $("#iframe3241").height($("#iframe3241").contents().find("body").height()+showittryitheight); alreadyWriteCode3241 = code3241; $("#rendering3241").hide(); $("#rendered3241").show(); } var tRereshRetry2DemoPanel3241 = setInterval(rereshRetry2DemoPanel3241,1000); var binded3241 = false; $("textarea#stepcodeTextarea3241").keyup(function(){ if(!binded3241){ $(window).bind('beforeunload',function(){ binded3241 = true; return "xxxx"; }); } var newCode = $(this).val() code3241 = newCode; /*below code is replaced by function rereshRetry2DemoPanel()*/ // if(code3241!=newCode){ // window.frames["iframe3241"].document.write("
"); // window.frames["iframe3241"].document.write(decodeHtml($("textarea#stepcodeTextarea3241").val())); // window.frames["iframe3241"].document.close(); // $(window.frames["iframe3241"]).load(function(){ // $("#iframe3241").height($("#iframe3241").contents().find("body").height()+showittryitheight); // }); // code3241 = newCode; // } }); $(".tryButton3241").click(function(){ $("#tryDiv3241").show(); $("#stepcodeTextarea3241").focus(); $("#stepcodeTextarea3241").height(200); $("#iframe3241").height(0); window.frames["iframe3241"].document.write("
"); window.frames["iframe3241"].document.write(decodeHtml($("textarea#stepcodeTextarea3241").val())); window.frames["iframe3241"].document.close(); //load和下面的非load必需并存,因为如果代码用到了jquery就必须使用load的方式 $(window.frames["iframe3241"]).load(function(){ $("#iframe3241").height($("#iframe3241").contents().find("body").height()+showittryitheight); }); $("#iframe3241").height($("#iframe3241").contents().find("body").height()+showittryitheight); this.scrollIntoView(true); editor3241.focus(); editor3241.setSize(null, "250"); $("#rendering3241").hide(); $("#rendered3241").hide(); }); var mixedMode = { name: "htmlmixed", scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i, mode: null}, {matches: /(text|application)\/(x-)?vb(a|script)/i, mode: "vbscript"}] }; var editor3241 = CodeMirror.fromTextArea(document.getElementById("stepcodeTextarea3241"), { lineNumbers: true, styleActiveLine: true, matchBrackets: true, mode:"text/html", theme:"eclipse", selectionPointer: true, lineWrapping: true, extraKeys: { "Alt-/": "autocomplete", "Ctrl-F": "findPersistent", "F8": function(cm) { cm.setOption("fullScreen", !cm.getOption("fullScreen")); }, "Esc": function(cm) { if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false); } } }); editor3241.on("change",function(doc){ if(!binded3241){ $(window).bind('beforeunload',function(){ binded3241 = true; return "xxxx"; }); } var newCode = doc.getValue(); code3241 = newCode; $("textarea#stepcodeTextarea3241").val(newCode); if(alreadyWriteCode3241!=code3241){ lastModifedTime3241 = new Date().getTime(); $("#rendering3241").show(); $("#rendered3241").hide(); } // alert(doc.getValue()); }); $(".CodeMirror").addClass("form-control"); // var editor3241 = CodeMirror.fromTextArea(, { // lineNumbers: true, // styleActiveLine: true, // matchBrackets: true, // theme:"eclipse", // }); editor3241.on("change",function(doc){ // alert(doc.getValue()); }); $("#tryDiv3241").hide(); }); $("div.codemirrorTips span").addClass("glyphicon glyphicon-asterisk");


源代码
1. 双击选中单词 2. 三击选中整行 3. CTRL+F 查找 4. F8 全屏编辑,再次点击恢复
渲染中 渲染完成
效果
步骤 2 :

布局

增值内容,请先登录
步骤 3 :

纯html

增值内容,请先登录
步骤 4 :

加上样式

增值内容,请先登录
步骤 5 :

样式讲解

增值内容,请先登录
步骤 6 :

再整合在一起

增值内容,请先登录


HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。


关于 实践项目-天猫前端-产品详情 的提问

尽量提供截图代码异常信息,有助于分析和解决问题。 也可进本站QQ群交流: 620943819
提问尽量提供完整的代码,环境描述,越是有利于问题的重现,您的问题越能更快得到解答。
对教程中代码有疑问,请提供是哪个步骤,哪一行有疑问,这样便于快速定位问题,提高问题得到解答的速度
在已经存在的几千个提问里,有相当大的比例,是因为使用了和站长不同版本的开发环境导致的,比如 jdk, eclpise, idea, mysql,tomcat 等等软件的版本不一致。
请使用和站长一样的版本,可以节约自己大量的学习时间。 站长把教学中用的软件版本整理了,都统一放在了这里, 方便大家下载: http://how2j.cn/k/helloworld/helloworld-version/1718.html

上传截图