Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: jQuery
Hai Everyone
jQuery not work in Google Chrome,but it work in ie8,fire fox.
My actual process is i want change the height and width of the table .My JQuery code is
 
function InitLoad() {
 
    var w = $(window).width();
    var windowHight = $(window).height() - 123;
     
    if (PageTitle == "Default.aspx") {
 

        $(".centertbl").css({ "height": windowHight + "px" });
        $(".centertbl").css({ "width": w + "px" });
        $(".fowi").css({ "width": w + "px" });
        
    }
}
and
i call .centertbl as class in html table
<table class="centertbl"  width="100%"  
style="background-color: #C0C0C0; overflow: hidden; margin :0px">
                    <tr>
                     <td style="padding-removed 1%; height: 5px" colspan="2"></td>
                     </tr></table>
 
the above code worked for change the height and width based on browser inner height and width for table,if i run in ie8 and mozila it will work.i.e it will dynamically change height and width,but i chrome it not work pls reply how to solve this problem and also support all browser.
 
Pls reply asap
 
Regards
Aravind
Posted 13-Jul-13 9:01am
Aravindba5.5K
Comments
ryanb31 at 13-Jul-13 22:07pm
   
You'll have to use chromes developer tools to figure out why.
Sergey Alexandrovich Kryukov at 14-Jul-13 1:16am
   
Why are you using style class and element-embedded style (via the attribute "style")? Even though it's technically possible, it looks like a pretty big abuse. No wonder you can easily mess up things the way some layout engines are confused.
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Please see my comment to the question. Try to use only the style referenced through the HTML element class. I cannot guarantee that it immediately resolves your problem, but this is the way to sort things out properly. You should opt for consistent style programming in all cases, even if you did not have your present problem. So, please try.
 
—SA
  Permalink  
v2
Comments
Aravindba at 14-Jul-13 9:21am
   
can u write bit of code here ?
centertbl is available in master page using javascript i change widht and height dynamically,in page init it change all child page.
-BA
Sergey Alexandrovich Kryukov at 14-Jul-13 23:19pm
   
What can I possibly write here?
I advised you to remove slyle="..." and move the content (in quotation marks) to CSS.
From your question, I guessed you know CSS or... don't you?
—SA
Aravindba at 14-Jul-13 23:26pm
   
why u say remove style ? i am not ask about style="...." ,i am asking about class(class="centertbl" ) and i find solution for support for all brower.
my old code is $(".centertbl").css({ "width": w + "px" }); and i change to $(".centertbl").css("width", w + "px");.
did u find and different ? just i remove whole barcket.Before u reply first u read question clearly and reply.my question is jquery not work in chrome only and specified place(class="centertbl") for change height and width and i not ask about background color,overflow or margin.
Sergey Alexandrovich Kryukov at 15-Jul-13 8:25am
   
Because having a mess is a source of problems, including incompatibilities. And did you spot the difference between "remove" and "move"?
Have all styles in CSS, just try.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 605
1 Maciej Los 319
2 BillWoodruff 184
3 Richard MacCutchan 180
4 Suraj Sahoo | Coding Passion 180
0 OriginalGriff 8,654
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,229
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 14 Jul 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100