<td>添加title属性悬浮显示

由于列表展示区域有限,因此将一些数据在鼠标悬浮时展示出来。

[#if goods.sell_type==1]
<td class="readonly-code" title="零售价:${amountConv(goods.retail_price)}元">${goods.goods_name}</td>
[#else]
<td class="readonly-code" title="预定金:${amountConv(goods.reserve_price)}元">${goods.goods_name}</td>
[/#if]
可以写入数据,也可以展示后台遍历的值


<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>首页</title> <link href="css/style.css" rel="stylesheet" type="text/css"> </head> <body> <div class="box"> <nav> <img src="img/logo.png"> <ul id="nar"> <li class="lis"> <a href="index.html">首页</a> </li> <li class="lis"> <a href="page1.html">热门景点</a> </li> <li class="lis"> <a href="page2.html">特产美食</a> <ul class="lison"> <li><a href="#">特产</a></li> <li><a href="#">美食</a></li> </ul> </li> <li class="lis"> <a href="page3.html">民俗文化</a> <ul class="lison"> <li><a href="#">西河大鼓</a></li> <li><a href="#">吴桥杂技</a></li> <li><a href="#">河北梆子</a></li>> </ul> </li> <li class="lis"> <a href="page4.html">用户调研</a> </li> </ul> <div id="time"></div> </nav> <div class="banner"> <ul class="banner_pic" id="banner_pic"> <li class="current"><img class="one" src="img/p2.jpg" /></li> <li class="pic"><img class="one" src="img/p1.jpg" /></li> <li class="pic"><img class="one" src="img/p3.jpg" /></li> </ul> <ol id="button"> <li class="current"></li> <li class="but"></li> <li class="but"></li> </ol> </div> <table class="city"> <tr> <td><img src="img/p4.jpg"></td> <td><img src="img/p5.jpg"></td> <td><img src="img/p6.jpg"></td> <td><img src="img/p7.jpg"></td> <td><img src="img/p8.jpg"></td> </tr> <tr> <td> <h2>石家庄</h2> </td> <td> <h2>唐山</h2> </td> <td> <h2>张家口</h2> </td> <td> <h2>保定</h2> </td> <td> <h2>秦皇岛</h2> </td> </tr> </table> <h1>——<span>河北宣传片</span>——</h1> <div class="video"> <video src="img/shipin.mp4" controls></video> <p>这片土地既丰富又神秘<br> 没有人知道<br> 还有多少未知的物种等待去发现<br> 而即便是那些已经被广泛知晓的物种<br> 以我们目前的认知<br> 也仅仅只掌握了密码的一小部分<br> 每种生命都是复杂而珍贵的<br> 尊重和爱护它们的密码<br> 也是在保护我们自身的未来<br> 人们未来美好生活的蓝图<br> 建立在生物多样性的繁盛之上<br> 这张蓝图宏伟且谦卑<br> 它既承载着中国智慧<br> 也承载着世界生态文明的未来<br> <span>视频来源:河北文旅</span> </p> </div> <footer> <div> <p>电话:1234567890<br> 邮箱:[email protected]<br> </p> <img src="img/logo.png"> </div> <p style="text-align: center;">©河北文旅</p> </footer> </div> <script src="js/js.js"></script> </body> </html>每行代码都是什么意思,每行代码全部打出来
06-06
通过这段代码进行修改JavaScript:// A simple demo of 3D Tiles feature picking with hover and select behavior // Building data courtesy of NYC OpenData portal: http://www1.nyc.gov/site/doitt/initiatives/3d-building.page const viewer = new Cesium.Viewer("cesiumContainer", { terrain: Cesium.Terrain.fromWorldTerrain(), }); viewer.scene.globe.depthTestAgainstTerrain = true; // Set the initial camera view to look at Manhattan const initialPosition = Cesium.Cartesian3.fromDegrees( -74.01881302800248, 40.69114333714821, 753, ); const initialOrientation = new Cesium.HeadingPitchRoll.fromDegrees( 21.27879878293835, -21.34390550872461, 0.0716951918898415, ); viewer.scene.camera.setView({ destination: initialPosition, orientation: initialOrientation, endTransform: Cesium.Matrix4.IDENTITY, }); // Load the NYC buildings tileset try { const tileset = await Cesium.Cesium3DTileset.fromIonAssetId(75343); viewer.scene.primitives.add(tileset); } catch (error) { console.log(`Error loading tileset: ${error}`); } // HTML overlay for showing feature name on mouseover const nameOverlay = document.createElement("div"); viewer.container.appendChild(nameOverlay); nameOverlay.className = "backdrop"; nameOverlay.style.display = "none"; nameOverlay.style.position = "absolute"; nameOverlay.style.bottom = "0"; nameOverlay.style.left = "0"; nameOverlay.style["pointer-events"] = "none"; nameOverlay.style.padding = "4px"; nameOverlay.style.backgroundColor = "black"; // Information about the currently selected feature const selected = { feature: undefined, originalColor: new Cesium.Color(), }; // An entity object which will hold info about the currently selected feature for infobox display const selectedEntity = new Cesium.Entity(); // Get default left click handler for when a feature is not picked on left click const clickHandler = viewer.screenSpaceEventHandler.getInputAction( Cesium.ScreenSpaceEventType.LEFT_CLICK, ); // Update the 'nameOverlay' for the given picked feature, // at the given (screen) position. function updateNameOverlay(pickedFeature, position) { if (!Cesium.defined(pickedFeature)) { nameOverlay.style.display = "none"; return; } // A feature was picked, so show its overlay content nameOverlay.style.display = "block"; nameOverlay.style.bottom = `${viewer.canvas.clientHeight - position.y}px`; nameOverlay.style.left = `${position.x}px`; const name = pickedFeature.getProperty("BIN"); nameOverlay.textContent = name; } // Create the HTML that will be put into the info box that shows // information about the currently selected feature function createPickedFeatureDescription(pickedFeature) { const description = `${ '<table class="cesium-infoBox-defaultTable"><tbody>' + "<tr><th>BIN</th><td>" }${pickedFeature.getProperty("BIN")}</td></tr>` + `<tr><th>DOITT ID</th><td>${pickedFeature.getProperty( "DOITT_ID", )}</td></tr>` + `<tr><th>SOURCE ID</th><td>${pickedFeature.getProperty( "SOURCE_ID", )}</td></tr>` + `<tr><th>Longitude</th><td>${pickedFeature.getProperty( "Longitude", )}</td></tr>` + `<tr><th>Latitude</th><td>${pickedFeature.getProperty( "Latitude", )}</td></tr>` + `<tr><th>Height</th><td>${pickedFeature.getProperty("Height")}</td></tr>` + `<tr><th>Terrain Height (Ellipsoid)</th><td>${pickedFeature.getProperty( "TerrainHeight", )}</td></tr>` + `</tbody></table>`; return description; } // If silhouettes are supported, silhouette features in blue on mouse over and silhouette green on mouse click. // If silhouettes are not supported, change the feature color to yellow on mouse over and green on mouse click. if (Cesium.PostProcessStageLibrary.isSilhouetteSupported(viewer.scene)) { // Silhouettes are supported const silhouetteBlue = Cesium.PostProcessStageLibrary.createEdgeDetectionStage(); silhouetteBlue.uniforms.color = Cesium.Color.BLUE; silhouetteBlue.uniforms.length = 0.01; silhouetteBlue.selected = []; const silhouetteGreen = Cesium.PostProcessStageLibrary.createEdgeDetectionStage(); silhouetteGreen.uniforms.color = Cesium.Color.LIME; silhouetteGreen.uniforms.length = 0.01; silhouetteGreen.selected = []; viewer.scene.postProcessStages.add( Cesium.PostProcessStageLibrary.createSilhouetteStage([ silhouetteBlue, silhouetteGreen, ]), ); // Silhouette a feature blue on hover. viewer.screenSpaceEventHandler.setInputAction(function onMouseMove(movement) { // If a feature was previously highlighted, undo the highlight silhouetteBlue.selected = []; // Pick a new feature const pickedFeature = viewer.scene.pick(movement.endPosition); updateNameOverlay(pickedFeature, movement.endPosition); if (!Cesium.defined(pickedFeature)) { return; } // Highlight the feature if it's not already selected. if (pickedFeature !== selected.feature) { silhouetteBlue.selected = [pickedFeature]; } }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); // Silhouette a feature on selection and show metadata in the InfoBox. viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) { // If a feature was previously selected, undo the highlight silhouetteGreen.selected = []; // Pick a new feature const pickedFeature = viewer.scene.pick(movement.position); if (!Cesium.defined(pickedFeature)) { clickHandler(movement); return; } // Select the feature if it's not already selected if (silhouetteGreen.selected[0] === pickedFeature) { return; } // Save the selected feature's original color const highlightedFeature = silhouetteBlue.selected[0]; if (pickedFeature === highlightedFeature) { silhouetteBlue.selected = []; } // Highlight newly selected feature silhouetteGreen.selected = [pickedFeature]; // Set feature infobox description viewer.selectedEntity = selectedEntity; selectedEntity.description = createPickedFeatureDescription(pickedFeature); }, Cesium.ScreenSpaceEventType.LEFT_CLICK); } else { // Silhouettes are not supported. Instead, change the feature color. // Information about the currently highlighted feature const highlighted = { feature: undefined, originalColor: new Cesium.Color(), }; // Color a feature yellow on hover. viewer.screenSpaceEventHandler.setInputAction(function onMouseMove(movement) { // If a feature was previously highlighted, undo the highlight if (Cesium.defined(highlighted.feature)) { highlighted.feature.color = highlighted.originalColor; highlighted.feature = undefined; } // Pick a new feature const pickedFeature = viewer.scene.pick(movement.endPosition); updateNameOverlay(pickedFeature, movement.endPosition); if (!Cesium.defined(pickedFeature)) { return; } // Highlight the feature if it's not already selected. if (pickedFeature !== selected.feature) { highlighted.feature = pickedFeature; Cesium.Color.clone(pickedFeature.color, highlighted.originalColor); pickedFeature.color = Cesium.Color.YELLOW; } }, Cesium.ScreenSpaceEventType.MOUSE_MOVE); // Color a feature on selection and show metadata in the InfoBox. viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) { // If a feature was previously selected, undo the highlight if (Cesium.defined(selected.feature)) { selected.feature.color = selected.originalColor; selected.feature = undefined; } // Pick a new feature const pickedFeature = viewer.scene.pick(movement.position); if (!Cesium.defined(pickedFeature)) { clickHandler(movement); return; } // Select the feature if it's not already selected if (selected.feature === pickedFeature) { return; } selected.feature = pickedFeature; // Save the selected feature's original color if (pickedFeature === highlighted.feature) { Cesium.Color.clone(highlighted.originalColor, selected.originalColor); highlighted.feature = undefined; } else { Cesium.Color.clone(pickedFeature.color, selected.originalColor); } // Highlight newly selected feature pickedFeature.color = Cesium.Color.LIME; // Set feature infobox description viewer.selectedEntity = selectedEntity; selectedEntity.description = createPickedFeatureDescription(pickedFeature); }, Cesium.ScreenSpaceEventType.LEFT_CLICK); } html: <style> @import url(../templates/bucket.css); </style> <div id="cesiumContainer" class="fullSize"></div> <div id="loadingOverlay"><h1>Loading...</h1></div> <div id="toolbar"></div>
最新发布
06-12
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值