English 中文(简体)
视文字总结和窗户宽度变化CSS等级(Jquery或Java 字典)
原标题:Changing a CSS class depending on text wrap and window width (Jquery or JavaScript)

我有一个反应灵敏的设计,有几栏文字。 该栏有头2个标题,在标题左边浮动,是图像词——单是垂直的,以标题案文为准。 当我缩小窗口宽度时,问题就会出现。 当单项标题细列时,它们不再纵向地与标式一致。

基本上,我试图撰写一封信,把标题的那几类内容划为两条线,以便我能够改变它的核心位置。

我确实是新字,这样说,我不敢肯定如何写字,但这基本上是:

if window width > 768 and if lines of text in #services h2 = 1

#services h2 {
top:9px;
}

else

if window width > 768 and if lines of text in #services h2 > 1

#services h2 {
top:1px;
}

Could someone help me properly format this? I m already using jQuery for some other stuff so if it s possible to do it with that, that would be great.

感谢!

<>光线> 其中最重要的部分是,一行从1行到2时,改变一类财产。 这是关键部分:

if lines of text in #services h2 = 1

#services h2 {
top:9px;
}

else

if lines of text in #services h2 > 1

#services h2 {
top:1px;
}
问题回答

难道你不能仅仅把背景形象的垂直位置定为50%。 而不是在相对较小的宇宙变化中增加 j。

No JavaScript (includes jQuery) needed, use pure CSS: http://www.css3.info/preview/media-queries/.

http://css-tricks.com/css-media-queries/“rel=“nofollow”http://css-tricks.com/cs-media-queries/。

我并不肯定案文的行文路线以及案文的左边是:

- 我看见,看看这是否是你想要的。

$(window).resize(function(){
     var h =$( #services h2 ).css( line-height );
     var size = $(window).width();
     if (size > 768){
          if( $( #services h2 ).height() == h){
                 $( #services h2 ).css( top , 1px )
          }
     }else{
           if( $( #services h2 ).height() > 2*h){
                 $( #services h2 ).css( top , 9px )
          }
     }

});




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签