Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MediaDBViewerAPI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BA_SI-Projekt
MediaDBViewerAPI
Commits
1f75e8c0
Commit
1f75e8c0
authored
Feb 29, 2016
by
Nico Schallehn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
9203cfaf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
3 deletions
+109
-3
responsive-tables.css
webapp/css/responsive-tables.css
+38
-0
index.php
webapp/index.php
+4
-3
responsive-tables.js
webapp/js/responsive-tables.js
+67
-0
No files found.
webapp/css/responsive-tables.css
0 → 100644
View file @
1f75e8c0
/* Foundation v2.1.4 http://foundation.zurb.com */
/* Artfully masterminded by ZURB */
/* --------------------------------------------------
Table of Contents
-----------------------------------------------------
:: Shared Styles
:: Page Name 1
:: Page Name 2
*/
/* -----------------------------------------
Shared Styles
----------------------------------------- */
table
th
{
font-weight
:
bold
;
}
table
td
,
table
th
{
padding
:
9px
10px
;
text-align
:
left
;
}
/* Mobile */
@media
only
screen
and
(
max-width
:
767px
)
{
table
.responsive
{
margin-bottom
:
0
;
}
.pinned
{
position
:
absolute
;
left
:
0
;
top
:
0
;
background
:
#fff
;
width
:
35%
;
overflow
:
hidden
;
overflow-x
:
scroll
;
border-right
:
1px
solid
#ccc
;
border-left
:
1px
solid
#ccc
;
}
.pinned
table
{
border-right
:
none
;
border-left
:
none
;
width
:
100%
;
}
.pinned
table
th
,
.pinned
table
td
{
white-space
:
nowrap
;
}
.pinned
td
:last-child
{
border-bottom
:
0
;
}
div
.table-wrapper
{
position
:
relative
;
margin-bottom
:
20px
;
overflow
:
hidden
;
border-right
:
1px
solid
#ccc
;
}
div
.table-wrapper
div
.scrollable
{
margin-left
:
35%
;
}
div
.table-wrapper
div
.scrollable
{
overflow
:
scroll
;
overflow-y
:
hidden
;
}
table
.responsive
td
,
table
.responsive
th
{
position
:
relative
;
white-space
:
nowrap
;
overflow
:
hidden
;
}
table
.responsive
th
:first-child
,
table
.responsive
td
:first-child
,
table
.responsive
td
:first-child
,
table
.responsive.pinned
td
{
display
:
none
;
}
}
webapp/index.php
View file @
1f75e8c0
...
...
@@ -113,7 +113,8 @@ if($_GET["action"] == "filme"){
}
else
if
(
$_GET
[
"action"
]
==
"rechte"
){
$titel
=
"Rechteverwaltung"
;
$content
=
'<div class="content"><h1>Rechteverwaltung</h1>'
;
$JavaScript
=
'<link rel="stylesheet" href="css/responsive-tables.css">
<script src="js/responsive-tables.js"></script>'
;
if
(
!
file_exists
(
API_Rights
)){
// defaultdatei anlegen...
$content
.=
"Erzeuge Default Rechtedatei <br>"
.
PHP_EOL
;
...
...
@@ -134,7 +135,7 @@ if($_GET["action"] == "filme"){
ob_start
();
var_dump
(
$Data
);
$content
.=
ob_get_clean
();
$content
.=
'<
div class="table-scrollable"><table border="1
">'
.
PHP_EOL
;
$content
.=
'<
table border="1" class="responsive
">'
.
PHP_EOL
;
$content
.=
'<tr><th>Von</th><th>bis</th>'
;
foreach
(
$API
->
SpaltenFilme
as
$value
)
{
$content
.=
'<th>'
.
$value
.
'</th>'
;
...
...
@@ -143,7 +144,7 @@ if($_GET["action"] == "filme"){
foreach
(
$Data
as
$value
)
{
$content
.=
TableRowRights
(
$API
,
$value
);
}
$content
.=
'</table>
</div>
'
.
PHP_EOL
;
$content
.=
'</table>'
.
PHP_EOL
;
}
$content
.=
"</div>"
;
...
...
webapp/js/responsive-tables.js
0 → 100644
View file @
1f75e8c0
$
(
document
).
ready
(
function
()
{
var
switched
=
false
;
var
updateTables
=
function
()
{
if
((
$
(
window
).
width
()
<
767
)
&&
!
switched
){
switched
=
true
;
$
(
"table.responsive"
).
each
(
function
(
i
,
element
)
{
splitTable
(
$
(
element
));
});
return
true
;
}
else
if
(
switched
&&
(
$
(
window
).
width
()
>
767
))
{
switched
=
false
;
$
(
"table.responsive"
).
each
(
function
(
i
,
element
)
{
unsplitTable
(
$
(
element
));
});
}
};
$
(
window
).
load
(
updateTables
);
$
(
window
).
on
(
"redraw"
,
function
(){
switched
=
false
;
updateTables
();});
// An event to listen for
$
(
window
).
on
(
"resize"
,
updateTables
);
function
splitTable
(
original
)
{
original
.
wrap
(
"<div class='table-wrapper' />"
);
var
copy
=
original
.
clone
();
copy
.
find
(
"td:not(:first-child), th:not(:first-child)"
).
css
(
"display"
,
"none"
);
copy
.
removeClass
(
"responsive"
);
original
.
closest
(
".table-wrapper"
).
append
(
copy
);
copy
.
wrap
(
"<div class='pinned' />"
);
original
.
wrap
(
"<div class='scrollable' />"
);
setCellHeights
(
original
,
copy
);
}
function
unsplitTable
(
original
)
{
original
.
closest
(
".table-wrapper"
).
find
(
".pinned"
).
remove
();
original
.
unwrap
();
original
.
unwrap
();
}
function
setCellHeights
(
original
,
copy
)
{
var
tr
=
original
.
find
(
'tr'
),
tr_copy
=
copy
.
find
(
'tr'
),
heights
=
[];
tr
.
each
(
function
(
index
)
{
var
self
=
$
(
this
),
tx
=
self
.
find
(
'th, td'
);
tx
.
each
(
function
()
{
var
height
=
$
(
this
).
outerHeight
(
true
);
heights
[
index
]
=
heights
[
index
]
||
0
;
if
(
height
>
heights
[
index
])
heights
[
index
]
=
height
;
});
});
tr_copy
.
each
(
function
(
index
)
{
$
(
this
).
height
(
heights
[
index
]);
});
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment