首页 \ 问答 \ :在Webkit上的css多列布局中悬停状态元素(:hover state element within css multi-column layout on Webkit)

:在Webkit上的css多列布局中悬停状态元素(:hover state element within css multi-column layout on Webkit)

我正面临着一个多列布局中悬停图像的错误: http//codepen.io/kompuser/pen/CIwFo

在这个codepen中,我为一个figure元素中包含的每个img设置了一个简单的:hover属性。

布局是一个多列的div设置为水平滚动。

基本上,当没有滚动时,悬停的img表现正确。

容器div(甚至略微)滚动时会发生错误。 然后,任何img或figure元素悬停都表现不正确,我们可以看到创建了一个偏移/故障。

这在Chrome 38(Windows 7,OS X 10.9),Windows上的Safari 5.1.7,OS X上的Safari 7.0.6中得到了确认。

.entry-content{
    display:block;
    -moz-column-width:      240px;
    -webkit-column-width:   240px;
    -ms-column-width:       240px;
    column-width:           240px;

    -moz-column-gap:        1em;
    column-gap:             1em;
    -ms-column-gap:         1em;
    -webkit-column-gap:     1em;

    overflow-y:             hidden;
    overflow-x:             auto;
    height:                 480px;
    font-size:              16px;
    line-height:            19px;
    margin: 1em;
    padding: 1em;
    -webkit-overflow-scrolling: touch;
    clear:both;
    position:relative;
}


.entry-content figure {
  max-width:100%;
}

.entry-content figure:hover img {
  opacity:.5;
}

I'm facing a bug with images hovered in a multi-column layout : http://codepen.io/kompuser/pen/CIwFo

On this codepen, I've set a simple :hover property for each img contained in a figure element.

The layout is a multi-columned div set to be horizontally scrolled.

Basically, when not scrolled at all, the hovered img behave the right way.

The bug happens when the container div is (even slightly) scrolled. Then, any img or figure element hovered behaves incorrectly and we can see there is an offset/glitch created.

This is confirmed on Chrome 38 (Windows 7, OS X 10.9), Safari 5.1.7 on Windows, Safari 7.0.6 on OS X.

.entry-content{
    display:block;
    -moz-column-width:      240px;
    -webkit-column-width:   240px;
    -ms-column-width:       240px;
    column-width:           240px;

    -moz-column-gap:        1em;
    column-gap:             1em;
    -ms-column-gap:         1em;
    -webkit-column-gap:     1em;

    overflow-y:             hidden;
    overflow-x:             auto;
    height:                 480px;
    font-size:              16px;
    line-height:            19px;
    margin: 1em;
    padding: 1em;
    -webkit-overflow-scrolling: touch;
    clear:both;
    position:relative;
}


.entry-content figure {
  max-width:100%;
}

.entry-content figure:hover img {
  opacity:.5;
}

原文:https://stackoverflow.com/questions/26215871
更新时间:2022-04-19 06:04

最满意答案

我建议使用以下方法(当我需要类似的功能时,没有找到任何可用于spring-boot的东西,所以我决定自己动手):

  • 实现一个HttpServletRequestWrapper ,它将在使用InputStream时复制字节,这样你就可以多次重读请求体

  • 实现并注册一个Filter ,它将在进入时包装http请求,并在请求被消耗后记录完整的请求/响应,并且响应由端点生成

好的好处是您可以在一个日志记录语句中记录请求和响应,并将它们保存在日志文件中。


I suggest the following approach (haven't found anything available for spring-boot when I needed a similar functionality, so I've decided to roll my own):

  • Implement a HttpServletRequestWrapper which will copy the bytes as the InputStream is being consumed so you can re-read the request body multiple times

  • Implement and register a Filter which will wrap the http request on the way in and log the complete request/response after the request is consumed and the response is produced by the endpoint

Nice bonus is that you can log both request and response in one logging statement, keeping them together in the logfile.

相关问答

更多
  • 忘了发帖作为答案。 这是您可以投票的答案,但我在上述评论中提供了有关该解决方案的所有信息。 Forgot to post something as an answer. Here's an answer you can vote for, but I put all the information about the solution in the comments above.
  • 我建议使用以下方法(当我需要类似的功能时,没有找到任何可用于spring-boot的东西,所以我决定自己动手): 实现一个HttpServletRequestWrapper ,它将在使用InputStream时复制字节,这样你就可以多次重读请求体 实现并注册一个Filter ,它将在进入时包装http请求,并在请求被消耗后记录完整的请求/响应,并且响应由端点生成 好的好处是您可以在一个日志记录语句中记录请求和响应,并将它们保存在日志文件中。 I suggest the following approach ...
  • 我发现了问题,但我不知道为什么会发生这种情况...... 在UrlMappings中,我添加了下一条规则: "404"(controller:'error', action:'notFound') (我有一个“ErrorController”)。 但我不知道为什么这个更改会导致spring安全性问题,但如果我将其删除,应用程序可以正常工作。 谢谢! 特别是为评论getbuckts :) I found the problem, but I don't know why this happens... I ...
  • 更新呼叫,使其看起来像: http.post (path: 'ApplyLogin', body: postBody, contentType:JSON, requestContentType: URLENC) { 更新: HTTPBuilder hb = new HTTPBuilder( url ) hb.request( POST, JSON ){ req -> uri.path = 'EfetuarLogin' body = [ "grant_type": "password", ...
  • 我有同样的问题,让它工作会很好。 UPDATE 我在表单中添加了method="post" ,它就像魅力一样:) I have this same issue and it would be very nice to get it working. UPDATE I added method="post" to the form and it worked like a charm :)
  • 另一种选择是使用tomcat内置的访问日志记录。 http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Access_Log_Valve 我自己使用它,它是相当可配置的。 如何配置tomcat 6
  • 使用HttpClient而不是HTTPBuilder它没有任何问题。 所以我认为问题出在HTTPBuilder HttpClient client = HttpClientBuilder.create().build(); HttpGet request = new HttpGet('http://vrapi.verticalresponse.com/api/v1/contacts?type=basic'); // add request header request.addHeader("Authori ...
  • HTTP 1.1 RFC要求302重定向是绝对的 ,而不是相对位置。 即使它在某些浏览器中有效,但这些都超出了规范,我确信如果你做了一个相对的网址,某些实现将无法正常工作。 你看到这个问题的原因是因为apache正在发生SSL终止,而apache正在向Jetty发出一个vanilla HTTP请求。 所以Jetty正在获得一个非常的非HTTPS请求,所以它不知道发送HTTPS响应,而不是常规的HTTP响应。 如果您在Jetty中进行SSL终止,则不会出现问题(但Jetty在SSL终止时效果不佳)。 我们已经 ...
  • log4j的一个相当模糊的特性,称为MDC,似乎正是您所需要的。 像http://gustlik.wordpress.com/2008/07/05/user-context-tracking-in-log4j/ 如果您使用自定义AppFilter设置请求唯一值,它也可以在Grails中正常工作。 A rather obscure feature of log4j, called MDC seems to be exactly what you need. Something like http://gust ...
  • 这是没有详细记录的内容,或者您可以向您发送螺旋: 试试这个 : /* * Fix for No thread-bound request found: Are you referring to request attributes */ def webRequest = RequestContextHolder.getRequestAttributes() if(!webRequest) { def servletContext = ServletContextHolder.getServletC ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)