Solved

padding not getting applied

Posted on 2011-09-21
8
199 Views
Last Modified: 2012-06-21
-The text inside the table cells is too cramped.  My attempt to add some padding is not working:
-Is it possible to HIDE the 3rd column?
-If a row already has Gray background, I do not want the hover effect to do anything  (since the row is already selected).  Right now if I hover over the row after it has been selected, it undoes the selection coloring.


http://jsfiddle.net/knowlton/E9BZb/5/
0
Comment
Question by:knowlton
  • 4
  • 3
8 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 250 total points
ID: 36576495
Qestion 1 : http://jsfiddle.net/E9BZb/12/
$("td:last,th:last", 'table[id*="ShoppingShippingMethods1"] tr').hide()

Open in new window

Question 2 : http://jsfiddle.net/E9BZb/14/
$('tr:gt(0)', 'table[id*="ShoppingShippingMethods1"]').hover(

function() {
    $(this).closest("table").find("tr:gt(0)").css({"background-color": "","color": ""});
    $(this).css({
        "background-color": "blue",
        color: "white"
    });
}, function() {
//    $(this).css({
//        "background-color": "white",
//        color: "black"
//    });
});

Open in new window

0
 
LVL 17

Assisted Solution

by:sonawanekiran
sonawanekiran earned 250 total points
ID: 36578457
0
 
LVL 5

Author Comment

by:knowlton
ID: 36580773
Things are much improved.

But, the header padding is still not correct, and the selected row background still gets erased by the hover effect.

See my screencast.


My current jQuery code is here:

http://jsfiddle.net/knowlton/JZnw8/2/

One of the rows is highlighted, so you can test.

 $('table[id*="ShoppingShippingMethods1"] td').each(function ()
            {
                $(this).css("padding", "5px");
            });

            $('table[id*="ShoppingShippingMethods1"]').children().each(function ()
            {
                $('td').css("border", "1px solid black");
            });

            $('tr:gt(0)', 'table[id*="ShoppingShippingMethods1"]').hover(

                function ()
                {
                    $(this).css({
                        "background-color": "blue",
                        color: "white"
                    });
                }, function ()
                {
                    $(this).css({
                        "background-color": "white",
                        color: "black"
                    });
                });

            $("tr:eq(0)", 'table[id*="ShoppingShippingMethods1"]').css({
                "background-color": "grey",
                "color": "white"
            });

            $("td:last,th:last", 'table[id*="ShoppingShippingMethods1"] tr').hide()

Open in new window

0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 5

Author Comment

by:knowlton
ID: 36580818
0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36584970
Here is your final version

http://jsfiddle.net/JZnw8/6/
0
 
LVL 5

Author Comment

by:knowlton
ID: 36588075
It works on the jsfiddle site for sure.

But unfortunately, it does not work on the actual web page.  I don't know why.
0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 36591337
You need to open another question
0
 
LVL 5

Author Closing Comment

by:knowlton
ID: 36599239
thx
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question