이 기사의 예에서는 JS를 사용하여 이미지 강조 효과를 얻는 방법을 설명합니다. 참고하실 수 있도록 모든 사람과 공유하세요. 자세한 내용은 다음과 같습니다.
어제 친구가 사진 강조 효과를 만드는 데 도움을 달라고 했습니다. 어렵지는 않지만 매우 창의적입니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>name</title> <style type="text/css"> *{}{margin:0; padding:0;} a img{}{border:none;} #imagesBox {}{ width:165px; height:110px; position:relative; left:100px; top:100px; z-index:1; border:1px solid black; background-color:white;} #trans{}{ width:165px; height:110px; position:absolute; left:0; top:0; z-index:2; display:none; opacity:0.5; filter:alpha(opacity=50); background-color:black;} #imagesBox li {}{ width:55px; height:55px; float:left; overflow:hidden;} #imagesBox li a,#imagesBox li img {}{ width:55px; height:55px; display:block; cursor:pointer;} #imagesBox li img{}{ position:relative;} #imagesBox strong{}{position:absolute;left:0; top:50%; margin-top:-7px; z-index:999; display:block; color:white; width:100%; height:15px; text-align:center; z-index:999;} </style> <script type="text/javascript"> function gallery(obj){ var tit=obj.getAttribute("alt"); document.getElementById("show_tit").firstChild.nodeValue=tit; document.getElementById("trans").style.display='block'; obj.style.zIndex="3"; } function clearBg(obj){ document.getElementById("show_tit").firstChild.nodeValue=""; document.getElementById("trans").style.display='none'; obj.style.zIndex="1"; } </script> </head> <body> <div id="imagesBox"> <ul> <li><a href="#" title="名称1"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" onmouseover="gallery(this);" onmouseout="clearBg(this)" style="max-width:90%" style="max-width:90%" alt="名称1"/><span></span></a></li> <li><a href="#" title="名称2"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" onmouseover="gallery(this);" onmouseout="clearBg(this)" style="max-width:90%" style="max-width:90%" alt="名称2"/><span></span></a></li> <li><a href="#" title="名称3"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" onmouseover="gallery(this);" onmouseout="clearBg(this)" style="max-width:90%" style="max-width:90%" alt="名称3"/><span></span></a></li> <li><a href="#" title="名称4"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" onmouseover="gallery(this);" onmouseout="clearBg(this)" style="max-width:90%" style="max-width:90%" alt="名称4"/><span></span></a></li> <li><a href="#" title="名称5"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" onmouseover="gallery(this);" onmouseout="clearBg(this)" style="max-width:90%" style="max-width:90%" alt="名称5"/><span></span></a></li> <li><a href="#" title="名称6"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" onmouseover="gallery(this);" onmouseout="clearBg(this)" style="max-width:90%" style="max-width:90%" alt="名称6"/><span></span></a></li> </ul> <div id="trans"> </div> <strong id="show_tit"> </strong> </div> </body> </html>
처음에는 디자인 의도를 제대로 이해하지 못해 실수로 이런 효과를 만들어냈습니다.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>name</title> <style type="text/css"> *{margin:0; padding:0;} a img{border:none;} #imagesBox { width:165px; height:100px; position:relative; left:100px; top:100px;} #imagesBox li { width:55px; height:55px; float:left; overflow:hidden; position:relative;} #imagesBox li img { width:55px; height:55px; position:relative; z-index:2; } #imagesBox li span { line-height:100px; background:#000; position:absolute; top:0; left:0; z-index:3; opacity:0.5; filter:alpha(opacity=50); display:block; width:55px; height:55px;} #imagesBox li a:hover span{display:none;} #imagesBox strong{position:absolute;left:0; top:50%; margin-top:-7px; z-index:999; display:block; color:white; width:100%; height:15px; text- align:center;} </style> <script type="text/javascript"> function gallery(obj){ var tit=obj.getAttribute("title"); document.getElementById("show_tit").firstChild.nodeValue=tit; document.getElementById("imagesBox").onmouseout=function(){document.getElementById("show_tit").firstChild.nodeValue="这里显示 名字"}; } </script> </head> <body> <div id="imagesBox"> <ul> <li><a href="#" onmouseover="gallery(this);" title="名称1"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" style="max-width:90%" style="max-width:90%" alt="名称1"/><span></span></a></li> <li><a href="#" onmouseover="gallery(this);" title="名称2"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" style="max-width:90%" style="max-width:90%" alt="名称2"/><span></span></a></li> <li><a href="#" onmouseover="gallery(this);" title="名称3"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" style="max-width:90%" style="max-width:90%" alt="名称3"/><span></span></a></li> <li><a href="#" onmouseover="gallery(this);" title="名称4"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" style="max-width:90%" style="max-width:90%" alt="名称4"/><span></span></a></li> <li><a href="#" onmouseover="gallery(this);" title="名称5"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" style="max-width:90%" style="max-width:90%" alt="名称5"/><span></span></a></li> <li><a href="#" onmouseover="gallery(this);" title="名称6"><img src="/static/imghwm/default1.png" data-src="/images/artist//12053006018793_3.jpg" class="lazy" style="max-width:90%" style="max-width:90%" alt="名称6"/><span></span></a></li> </ul> <strong id="show_tit">这里显示名字</strong> </div> </body> </html>
이 기사가 JavaScript 프로그래밍에 종사하는 모든 사람에게 도움이 되기를 바랍니다.

如何使用JS和百度地图实现地图平移功能百度地图是一款广泛使用的地图服务平台,在Web开发中经常用于展示地理信息、定位等功能。本文将介绍如何使用JS和百度地图API实现地图平移功能,并提供具体的代码示例。一、准备工作使用百度地图API前,首先需要在百度地图开放平台(http://lbsyun.baidu.com/)上申请一个开发者账号,并创建一个应用。创建完成

如何使用JS和百度地图实现地图热力图功能简介:随着互联网和移动设备的迅速发展,地图成为了一种普遍的应用场景。而热力图作为一种可视化的展示方式,能够帮助我们更直观地了解数据的分布情况。本文将介绍如何使用JS和百度地图API来实现地图热力图的功能,并提供具体的代码示例。准备工作:在开始之前,你需要准备以下事项:一个百度开发者账号,并创建一个应用,获取到相应的AP

js字符串转数组的方法:1、使用“split()”方法,可以根据指定的分隔符将字符串分割成数组元素;2、使用“Array.from()”方法,可以将可迭代对象或类数组对象转换成真正的数组;3、使用for循环遍历,将每个字符依次添加到数组中;4、使用“Array.split()”方法,通过调用“Array.prototype.forEach()”将一个字符串拆分成数组的快捷方式。

如何使用JS和百度地图实现地图多边形绘制功能在现代网页开发中,地图应用已经成为常见的功能之一。而地图上绘制多边形,可以帮助我们将特定区域进行标记,方便用户进行查看和分析。本文将介绍如何使用JS和百度地图API实现地图多边形绘制功能,并提供具体的代码示例。首先,我们需要引入百度地图API。可以利用以下代码在HTML文件中导入百度地图API的JavaScript

js中new操作符做了:1、创建一个空对象,这个新对象将成为函数的实例;2、将新对象的原型链接到构造函数的原型对象,这样新对象就可以访问构造函数原型对象中定义的属性和方法;3、将构造函数的作用域赋给新对象,这样新对象就可以通过this关键字来引用构造函数中的属性和方法;4、执行构造函数中的代码,构造函数中的代码将用于初始化新对象的属性和方法;5、如果构造函数中没有返回等等。

这篇文章主要为大家详细介绍了js实现打字小游戏,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下。

php在特定情况下可以读js内部的数组。其方法是:1、在JavaScript中,创建一个包含需要传递给PHP的数组的变量;2、使用Ajax技术将该数组发送给PHP脚本。可以使用原生的JavaScript代码或者使用基于Ajax的JavaScript库如jQuery等;3、在PHP脚本中,接收传递过来的数组数据,并进行相应的处理即可。

js全称JavaScript,是一种具有函数优先的轻量级,直译式、解释型或即时编译型的高级编程语言,是一种属于网络的高级脚本语言;JavaScript基于原型编程、多范式的动态脚本语言,并且支持面向对象、命令式和声明式,如函数式编程。


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

ZendStudio 13.5.1 맥
강력한 PHP 통합 개발 환경

SublimeText3 Linux 새 버전
SublimeText3 Linux 최신 버전

맨티스BT
Mantis는 제품 결함 추적을 돕기 위해 설계된 배포하기 쉬운 웹 기반 결함 추적 도구입니다. PHP, MySQL 및 웹 서버가 필요합니다. 데모 및 호스팅 서비스를 확인해 보세요.

Atom Editor Mac 버전 다운로드
가장 인기 있는 오픈 소스 편집기

mPDF
mPDF는 UTF-8로 인코딩된 HTML에서 PDF 파일을 생성할 수 있는 PHP 라이브러리입니다. 원저자인 Ian Back은 자신의 웹 사이트에서 "즉시" PDF 파일을 출력하고 다양한 언어를 처리하기 위해 mPDF를 작성했습니다. HTML2FPDF와 같은 원본 스크립트보다 유니코드 글꼴을 사용할 때 속도가 느리고 더 큰 파일을 생성하지만 CSS 스타일 등을 지원하고 많은 개선 사항이 있습니다. RTL(아랍어, 히브리어), CJK(중국어, 일본어, 한국어)를 포함한 거의 모든 언어를 지원합니다. 중첩된 블록 수준 요소(예: P, DIV)를 지원합니다.
