- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我已经尝试了一些方法,但我不太确定我的问题是代码还是框架竞争。为了披露,我在一个 aspx 站点中,链接的 css,Kentico 10,使用 jquery、jquery ui 和 bootstrap。
我在做什么:通过 jquery 替换 img src。这行得通。
目标:并非所有图像都具有相同的尺寸。我希望图像的尺寸在旧尺寸和新图像源的尺寸之间“动态变化”。如您所料,它正在做的只是闪烁到新的大小。周围的布局对象只是传送到新位置。
问题:我应用到图像标签的转换似乎没有下蹲。
代码...请注意,具有 CSS 类 productImage
的图像标签位于转发器内:
CSS:
.mainImage {
max-width: 551px;
cursor: pointer;
-webkit-transition: all .6s ease-in-out !important;
-moz-transition: all .6s ease-in-out !important;
-o-transition: all .6s ease-in-out !important;
-ms-transition: all .6s ease-in-out !important;
transition: all .6s ease-in-out !important;
}
HTML:
这是主图像,将更改 img src 的目标。
<div class="col-md-6">
<asp:Image ImageUrl="http://placehold.it/551x373" runat="server" ID="imgProduct" AlternateText="Product Image" ToolTip="Product Image" CssClass="mainImage" />
</div>
...
这是您单击的图像缩略图,它会触发 javsacript src 替换并且位于转发器内。请注意,data-target
属性是在服务器端设置的,并且仅包含我们希望将主图像更改为的 src url 的 url。
<div class="col-sm-1">
<asp:Image ImageUrl="http://placehold.it/64x64" runat="server" ID="img1" AlternateText="Product Image" ToolTip="Product Image" CssClass="productImage" onclick="ShowImage(this);" />
</div>
JavaScript:
function ShowImage(ctl) { //this is already a jquery item...
var targetImage = $("#<%= imgProduct.ClientID %>");
targetImage.attr("src", $(ctl).attr("data-target"));
}
$(document).ready(function () {
ShowImage($("[id$='img1']:first"));
});
最佳答案
要使高度和宽度过渡生效,您需要在 CSS 或样式标签中指定高度和宽度。
看来您正在交换图像 URL 并让图像的原始尺寸(由 placehold.it 的 URL 提供)来设置布局。如果没有动画参数,浏览器会立即重新呈现布局而无需任何过渡。
关于javascript - 替换 img src,缓解高度/宽度差异?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42448464/
在我早期的 R 生活中,当涉及到目录和子目录之间的分隔符时,我发现了 R 和 Windows 在不同页面上的痛苦。尽管我知道这个问题,但我仍然因为必须手动在所有反斜杠前面放置一个反斜杠或用正斜杠替换所
我正在尝试使用名为 easeInBounce 的缓动 jQuery 函数,但它不起作用。我搜索了所有相关内容,所有页面都说我必须像这里一样放置 {easing:'easeInBounce'} 但它不起
我不明白为什么使用 fgets 获取输入总是给我的程序“密码错误”。 但是,当我使用 gets() 时,比如 gets(array); 它起作用了。 预期输出:当密码错误时,打印“Wrong Pass
我刚刚给了this Hadoop tuorial在 JobTracker 中读取 Hadoop 有跟腱(单点故障)的状态: The JobTracker is a single point of fa
我有一个关于 csrf 缓解的问题。文献建议在每个页面上使用 token ,该 token 必须与任何表单一起提交 - 此 token 必须有效才能进行交易。 页面上的 token 如何防止 csrf
.NET 中是否有任何预先存在的方法来检测/防止 xpath 注入(inject)攻击? 我可以预见 2 个例子,但可能还有更多。 例如 "/Some/XPath/" + UntrustedNodeN
我已经在 http://jsfiddle.net/GxpSQ/ 上发布了一个代码有一个工作代码。单击该框,它将随机播放。 基于 hungred.com 我的代码基于此示例 http://hungred
我最近不得不迁移一个由负载均衡器和三个后端组成的基础架构。每个后端都设置了 apache2 来处理 HTTP/HTTPs 请求,并通过 AJP 协议(protocol)将它们转发到 tomcat 服务
系统的一个模块处理基于 JSON 的协议(protocol),该协议(protocol)用于传输各种数据。这导致了将近一百个小代码段,如下所示: /* * Data package Foo re
我希望有人能够帮助我理解这个问题,以及我是否需要采取任何额外步骤来保护我的应用程序。 阅读此特定漏洞,它似乎会影响符合以下条件的服务器: 从使用 HTTP 级压缩的服务器提供服务 在 HTTP 响应主
我希望能够在具有 REPR CStruct/CPointer 的类中使用双指针: typedef struct CipherContext { void *cipher;
我有一个X509Certificate2实例,并获取其PrivateKey属性,这是一个 RsaCryptoServiceProvider 。 MSDN 文档表明此 RsaCryptoServiceP
我们用于安全测试的第三方工具在 Tomcat 8 上存在慢速 HTTP POST 漏洞。我们在应用程序中有一个简单的 Spring Controller 和 JSP。 现有的 Tomcat 连接器配置
我已经设置了useHttpOnly=true在 tomcat context.xml 中,并且正在使用使用 java keytool 在 server.xml 连接器元素支持中生成的自签名证书来支持
根据 Azure 文档 github 问题 ( https://github.com/MicrosoftDocs/azure-docs/issues/75652 ) 中的 Azure 支持响应,Lin
我正在对我的 Java 代码执行 veracode 扫描,它在我的 DAO 类之一中引发以下错误 SQL 命令中使用的特殊元素的不正确中和(“SQL 注入(inject)”)CWE ID 89 但是,
我正在使用 Mongoose ODM wrapper对于 NodeJS,我担心注入(inject)攻击。假设我有以下架构: const UserSchema = new mongoose.Schema
我们有一个 jaxrs 服务,不幸的是执行了原始查询,没有准备好的语句。我们使用 ESAPI 来缓解 XSS、SQLI。如下所示: private String mitigateSQLI(String
我正在尝试减轻我们对 Poodle SSL 3.0 Fallback 的脆弱性攻击。我们的管理员已经开始禁用 SSL 以支持 TLS 用于与我们服务器的入站连接。我们还建议我们的团队在他们的网络浏览器
我在 Heroku 上有一个应用程序(免费计划),并且在从 Django 管理上传媒体文件时经常收到应用程序错误。我使用 S3 来提供静态和媒体服务。通过 django admin 直接将文件上传到
我是一名优秀的程序员,十分优秀!