首页 \ 问答 \ 使用默认主题将图像置于Nivo Slider上?(Centering image on Nivo Slider using default theme?)

使用默认主题将图像置于Nivo Slider上?(Centering image on Nivo Slider using default theme?)

对于任何使用Nivo Slider的人来说,是否有任何直接的方式(或不是)将图像置于滑块上? 我知道Nivo Slider的设计是为了显示完美“适合”盒子的图像(与我使用的方式不同),但出于技术原因,我宁愿尝试让图像居中,而不是使所有图像完美适合Nivo盒子的宽度和高度。 目前我的Nivo幻灯片看起来像这样:

http://dl.dropbox.com/u/12453703/nivo.png

对不起,我没有提供任何代码示例,我尝试这一点。 我的CSS知识不是太好,我在解决问题时的大多数尝试都是在网络上寻找解决方案(并试图应用所述解决方案),或者尝试在我的样式表中尝试随机单行试图修复问题。

如果你想知道我正在使用什么CSS文件,我使用的默认主题可以在这里下载: http : //cloud.github.com/downloads/gilbitron/Nivo-Slider/nivo-slider2。 7.1.zip

谢谢,我很感激。


To anyone who uses Nivo Slider, is there any straightforward way (or not) to center the image on the slider? I'm aware that Nivo Slider was designed to display images which perfectly "fit" the box (unlike the way I'm using it), but for technical reasons I'd rather try have the images centered instead of make all my images perfectly fit the Nivo box's width and height. Currently my Nivo slide looks like this:

http://dl.dropbox.com/u/12453703/nivo.png

Sorry I haven't provided any code examples of me trying this. My CSS knowledge isn't too great and most of my attempts at fixing the problem have either been looking at solutions on the web (and attempting to apply said solution), or trying out random one-lines in my stylesheet in an attempt to fix the problem.

If you'd like to know what CSS files I'm using, I'm using the default theme which can be downloaded here: http://cloud.github.com/downloads/gilbitron/Nivo-Slider/nivo-slider2.7.1.zip

Thanks, I appreciate it.


原文:https://stackoverflow.com/questions/9124324
更新时间:2023-10-20 21:10

最满意答案

你的问题太模糊了。 但我会尝试在下面回答; 您可以使用model属性来保存匹配的决策,因此可以在jsp中使用它。

我假设你有一个Data对象如下:

class Data{
    String fName;
    Date dob;
}

并且您的控制器处理程序方法代码可能具有一个模型属性来保存“匹配”标志

public String handlerMethod(Model model) {
    Data obj1;
    Data obj2;

    boolean   matched = SomeUtil.compare(obj2, obj2);
    model.addAttribute("cssClass"  , matched?"matched":"unmatched");

    return "yourjsp";
}

你的jsp可以有类的字段如下:

<div class="${cssClass}">
    Fields here..
</div>

您的css文件可以定义样式

.matched {
    ...
}
.unmatched {
    ...
}

看看它是否有帮助。


Your question is too vague. But I will try to answer below; You can have a model attribute to hold the matching decision, so it can be used in jsp.

I am assuming you have a Data object as below:

class Data{
    String fName;
    Date dob;
}

And your controller handler method code may have a model attribute to hold 'matched' flag

public String handlerMethod(Model model) {
    Data obj1;
    Data obj2;

    boolean   matched = SomeUtil.compare(obj2, obj2);
    model.addAttribute("cssClass"  , matched?"matched":"unmatched");

    return "yourjsp";
}

Your jsp can have field with class as below:

<div class="${cssClass}">
    Fields here..
</div>

Your css file can have the style defined

.matched {
    ...
}
.unmatched {
    ...
}

See if it helps.

相关问答

更多
  • spring
  • 我设法解决了我的问题。 仍然不确定这是否是最好的解决方案,但我想让别人知道,以防其他人需要相同的解决方案。 所以这是怎么回事,我有以下流程:controller - > {Velocity engine} - >本地化jtable配置 - > jsp 控制器获取模型并将其提供给速度模板。 在那里我也提供(除了我的速度模板模型):messageSource和localeResolver。 无论我在速度上有本地化标签,我都按如下方式编写它们:$ {messageSource.getMessage($ {fiel ...
  • 这种指令应该可以工作,但您需要确保您使用的路径: <%@ include file="/path_to/your_css_file.css" %> This sort of directive should work, but you will need to be sure of the path you're using: <%@ include file="/path_to/your_css_file.css" %>
  • 我做到了这一点。 我创建了一个新的route / resource / css | js,我使用内部资源视图解析器 - (文件夹)。 我的链接网址像/resource/css/qtn/page1.css一样潮湿。 在controller / resources / { type } / { page } .css中。 在这里,我获得了类型和页面值,并在我的动态jsp页面中使用它来实现我的结果。 为安全起见我检查了网址是否来自我自己的网页。 提示: 在使用内部资源视图解析器时,当您将页面值直接传递给资源URL ...
  • 如果你很善良,你的CSS请求将遵循某种聚合模式。 然后,您的结果将足够正确地设置缓存标头,ETag,并尊重“If-Modified-Since”标头(可能基于您决定包含的文件的最新更改日期)。 If you were kind, your CSS request would follow some kind of aggregation pattern.
  • 对jss源的简要检查让我相信你的答案在于创建不同的样式表。 从我的简要介绍看来,以后创建的样式表中的CSS似乎会覆盖以前创建的样式表中的CSS。 “阅读来源” Allllright, I figured out how to do it with jss:
    A div