Dynamic Colspan / Colspan All Columns On Bootstrap Sample
Có thể bạn quan tâm
Skip to content Search Gists Search Gists All gists Back to GitHub Sign in Sign up Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }}
afbora/dynamic_colspan.js Last active February 12, 2019 10:24 Show Gist options
Raw index.html This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment You can’t perform that action at this time.
Instantly share code, notes, and snippets.
- Download ZIP
- Star (1) You must be signed in to star a gist
- Fork (1) You must be signed in to fork a gist
- Embed Select an option
- Embed Embed this gist in your website.
- Share Copy sharable link for this gist.
- Clone via HTTPS Clone using the web URL.
No results found
Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/afbora/6c98337a3455d45b6ae4e620d5cfbcf2.js"></script> - Save afbora/6c98337a3455d45b6ae4e620d5cfbcf2 to your computer and use it in GitHub Desktop.
- Embed Embed this gist in your website.
- Share Copy sharable link for this gist.
- Clone via HTTPS Clone using the web URL.
No results found
Learn more about clone URLs Clone this repository at <script src="https://gist.github.com/afbora/6c98337a3455d45b6ae4e620d5cfbcf2.js"></script> Save afbora/6c98337a3455d45b6ae4e620d5cfbcf2 to your computer and use it in GitHub Desktop. Download ZIP Dynamic Colspan / Colspan All Columns on Bootstrap Sample Raw dynamic_colspan.js This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters| $(function() { |
| jQuery.fn.exists = function(){return this.length>0;} |
| // Dynamic Colspan |
| if($('[colspan="auto"]').exists()) |
| { |
| $.each($('[colspan="auto"]'), function( index, value ) { |
| var table = $(this).closest('table'); // Get Table |
| var siblings = $(this).closest('tr').find('th:visible, td:visible').not('[colspan="auto"]').length; // Count colspan siblings |
| var numCols = table.find('tr').first().find('th:visible, td:visible').length; // Count visible columns |
| $(this).attr('colspan', numCols.toString()-siblings); // Update colspan attribute |
| }); |
| } |
| }); |
| <table class="table"> |
| <thead> |
| <tr> |
| <th>#</th> |
| <th>First Name</th> |
| <th>Last Name</th> |
| <th>Username</th> |
| <th class="hidden-xs">Birthdate</th> |
| </tr> |
| </thead> |
| <tbody> |
| <tr> |
| <td colspan="auto">Employers</th> |
| </tr> |
| <tr> |
| <th scope="row">1</th> |
| <td>Mark</td> |
| <td>Otto</td> |
| <td>@mdo</td> |
| <td class="hidden-xs">1980</td> |
| </tr> |
| <tr> |
| <th scope="row">2</th> |
| <td>Jacob</td> |
| <td>Thornton</td> |
| <td>@fat</td> |
| <td class="hidden-xs">1975</td> |
| </tr> |
| <tr> |
| <th scope="row">3</th> |
| <td>Larry</td> |
| <td>the Bird</td> |
| <td>@twitter</td> |
| <td class="hidden-xs">1977</td> |
| </tr> |
| </tbody> |
| </table> |
Từ khóa » Html Table Td Colspan All
-
Colspan All Columns - Html - Stack Overflow
-
Colspan All Columns In HTML - Weston Ganger
-
HTML Td Colspan Attribute - W3Schools
-
Td Colspan All Code Example - Html
-
Html – Colspan All Columns - ITecNote
-
Table Rowspan And Colspan In HTML Explained (With Examples) »
-
Column-span - CSS: Cascading Style Sheets - MDN Web Docs
-
HTML | Colspan Attribute - GeeksforGeeks
-
Colspan All Columns - Newbedev
-
CSS Colspan: How To Create Multiple Columns In Your HTML Tables
-
Setting A Single Tr In A Row To Colspan='100%' Causes The Other Rows ...
-
Html - Colspan All Columns - MLink Developer Q&A
-
Colspan All Columns - Mdn Understanding Wcag, Guideline 1.4 ...
-
Tables In HTML Documents