javascript - 如何设置jQuery中图像的宽度?
问题描述
我正在尝试添加具有 Webgl 悬停效果的图像。效果 id 工作但是,我现在正在尝试为 jQuery 内部的图像设置宽度,
new hoverEffect({
parent: document.querySelector('.ticket'),
intensity1: 0.1,
intensity2: 0.1,
angle2: Math.PI / 2,
image1: 'https://source.unsplash.com/Le7_qK9JaLU/500x500',
image2: 'https://source.unsplash.com/XAqaeyzj3NM/500x500',
displacementImage: 'https://cdn.rawgit.com/robin-dela/hover-effect/b6c6fd26/images/stripe1mul.png?raw=true'
});
.ticket{
width: 100%;
height: 100%;
position: absolute;
background: black;
}
解决方案
如果想使用 jquery 设置图像的宽度。只需添加这一行
例子
$(".img1").css({ 'height': '200px', 'width': '210px' });
推荐阅读
- heroku - 当我使用雾宝石将 APP 中的图片上传到 AWS 时,$ heroku logs --tail 中出现“拒绝访问”错误
- javascript - 如何向有子元素的菜单元素添加箭头?
- python - 将 Tensorflow 中的张量与 None 轴连接起来
- python - 如何从文件中加载多个正则表达式模式并匹配给定的字符串?
- c - 循环中的Scanf无法输入任何内容
- npm - “纱线清单”列出了我没有安装的东西
- r - 如何优化布局绘图中的多行文本坐标和图例间距?
- intellij-idea - 如何使用 IntelliJ 插入 lambda (λ) 符号?
- angular - 带有 NGRX 的 Angular 7 - 通过多次调用选择器订阅商店属性
- java - 如何修复“类型未定义方法”错误