.pltR{ height: 1rem; margin-right: 1.5rem; font-size: 17px; color: black; padding: 20px;}.pltR:active { background-color: gray;}参考博客:给div添加点击效果
1.被
点击
时的
效果
可以用
div
:active{
css
}
2.鼠标覆盖在上面的时候可以用
div
:hover{
css
;}
3.
点击
之后的
效果
,这个相对前2种有些麻烦,必须用到JS或者jquery,步骤如下:
a.先给
div
添加一个选中的样式比如on{
css
};
b.然后在js中$(‘
div
’).click(function{
$(‘
div
’).toggleClass(’ ',‘on’);
这是jquery自带的一个方法,
点击
div
切换2个class,
实现
方法1:
使用 window.open 跳转,语法:window.open(*URL,name,specs,replace*) ,如下代码所示:
<
div
class="col-sm-6 col-lg-3" onclick="window.open('{{ url_for('user.inform') }}')">
<
div
clas.
在前端中,我们经常可以看到一个列表中,
点击
某一行的某个按钮这一行就展开来,呈现一个
div
,本文来介绍一下这种
效果
的
实现
。
首先,我们在Student类中写一个boolean类型的expand属性,设默认值为false,也就是默认状态下是不展开的。
然后我们写一个expand函数,该函数的功能是将当前对象的expand属性取反。
expand(student: Student){
st...