小编Isr*_*ack的帖子

jquery max-height和max-width返回错误的值

我有最大宽度和最大高度的问题.让我说我有以下css规则:

img.item { max-width: 325px; max-height: 390px; }
Run Code Online (Sandbox Code Playgroud)

和我的文档中的以下img:

<img class="item" src="http://us.dorothyperkins.com/wcsstore/DorothyPerkinsUS/images/catalog/80000095_normal.jpg">
Run Code Online (Sandbox Code Playgroud)

原始图像宽x高是:342 x 464

如果我尝试使用jquery获取max-width和max-height的值,我会弄错它们.

$('img.item').css('max-width');
// returns 357px
$('img.item').css('max-height');
// returns 429px
Run Code Online (Sandbox Code Playgroud)

关于这为什么的任何想法?或者我如何才能获得正确的尺码?

如果我用$('img.item').width() and $('img.item').height()我得到计算值,对我不好.

谢谢.

html javascript css jquery

5
推荐指数
1
解决办法
2万
查看次数

反应链接到静态html页面?

我有一个React + Redux应用程序,我想链接到一个privacy.html页面,它是项目根目录中的静态html文件,与index.html是反应应用程序.

问题是链接到/privacy.html<Route path='*' component={NotFoundView} />

有没有解决这个问题?

javascript reactjs react-router redux

4
推荐指数
1
解决办法
1744
查看次数

将测试标记为从 pytest_collection_modifyitems 跳过

如何在 pytest 收集过程中将测试标记为跳过?

我想要做的是让 pytest 收集所有测试,然后pytest_collection_modifyitems根据我从数据库获得的条件使用钩子将某个测试标记为跳过。

我找到了一个我不喜欢的解决方案,我想知道是否有更好的方法。

def pytest_collection_modifyitems(items, config):
    ... # get skip condition from database
    for item in items:
        if skip_condition == True:
            item._request.applymarker(pytest.mark.skipif(True, reason='Put any reason here'))
Run Code Online (Sandbox Code Playgroud)

此解决方案的问题是我正在访问_request该类的受保护成员 ( )。

python pytest

3
推荐指数
2
解决办法
3808
查看次数

标签 统计

javascript ×2

css ×1

html ×1

jquery ×1

pytest ×1

python ×1

react-router ×1

reactjs ×1

redux ×1