Solved

padding not getting applied

Posted on 2011-09-21
8
200 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!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to install NodejS to run a JavaScript application 3 42
SharePoint 2013 List with Ratings 6 91
javascript date picker in php while loop 5 81
Add or delete table rows 10 53
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
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…

839 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