Warning

 

Close

Confirm Action

Are you sure you wish to do this?

Confirm Cancel
BCM
User Panel

Posted: 7/28/2014 11:47:21 AM EDT
If so (why doesnt this change the positioning of the window?  Trying to center it.):




$(document).ready(function(){

     

$(window).resize(function(){

   $('.test').css({font-size:"60px"});

 $('.logo').css({

   font-size: 11.818181991577148px; background-color: rgb(255, 255, 255);']  

    - $('.logo').outerWidth())/2,

 

    - $('.logo').outerHeight())/2

 });

 x = ($(window).height()

    - $('.logo').outerHeight())/2;

});

$(window).resize();







});
Link Posted: 7/28/2014 11:50:56 AM EDT
[#1]
I'd trawl stackoverflow.com for answers
Link Posted: 7/28/2014 11:53:36 AM EDT
[#2]
Sure you can.



Context would help.




Also, "px" are "pixels".  You cannot have fractions of pixels, let alone something with 15 significant digits.  That's likely to make the display puke.  Round numbers only.  Negative numbers only in certain rare circumstances.




If you are using CSS, just do "margin: auto;" and it'll center without needing to know how big the display is.
Link Posted: 7/28/2014 12:13:11 PM EDT
[#3]
Sure, but I can't read that.

I hook resize this way:

   $(window).on('resize', function() { // do stuff });

I would do the {margin: auto} if you item is block display, { text-align: center} if inline.

   $("#item").css("margin", "auto");

jQuery rocks doesn't it?
Link Posted: 7/28/2014 12:40:13 PM EDT
[#4]
Thanks to all, I'll give those suggestions a try.


Close Join Our Mail List to Stay Up To Date! Win a FREE Membership!

Sign up for the ARFCOM weekly newsletter and be entered to win a free ARFCOM membership. One new winner* is announced every week!

You will receive an email every Friday morning featuring the latest chatter from the hottest topics, breaking news surrounding legislation, as well as exclusive deals only available to ARFCOM email subscribers.


By signing up you agree to our User Agreement. *Must have a registered ARFCOM account to win.
Top Top