Table data is normally repeatable by nature. ng-repeat directive can be used to draw table easily. Following example states the use of ng-repeat directive to draw a table. <table> <tr> <th> Name </th> <th> Marks </th> </tr> <tr ng-repeat = "subject in student.subjects" > <td> {{ subject.name }} </td> <td> {{ subject.marks }} </td> </tr> </table> Table can be styled using CSS Styling. <style> table , th , td { border : 1px solid grey ; border - collapse : collapse ; padding : 5px ; } table tr : nth - child ( odd ) { background - color : #f2f2f2; } table tr : nth - child ( even ) { background - color : #ffffff; } </style> Example Following example will showcase all the above mentioned directive. <html> <head> <...
<!-- this script got from www.crestinfotech.com-Coded by: Manish Wagh-->
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
jQuery.extend(jQuery.easing, {easeOutExpo:function (x, t, b, c, d) { //see: http://gsgd.co.uk/sandbox/jquery/easing/
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
}
});
(function($){
$.fn.overlaycontent=function(options) {
var setting={id:'', dir:'up', speed:200, opacity:1}
return this.each(function(){
$.extend(setting, options, (this.getAttribute('data-overlayid'))? {id:this.getAttribute('data-overlayid')} : {})
var $target=$(this).css({position:'relative', overflow:'hidden'}) //set anchor DIV position to relative
var $overlay=$('#'+(setting.id)) //reference overlay DIV box
var startpoint={}
if (setting.dir=="up" || setting.dir=="down"){ //set initial position of overlay box (either "top" or "left" property affected)
startpoint={top:$target.outerHeight()* (setting.dir=="down"? -1 : 1)}
}
else{
startpoint={left:$target.outerWidth()* (setting.dir=="right"? -1 : 1)}
}
var overlaydimenions={w:$target.outerWidth()-($overlay.outerWidth()-$overlay.width()), h:$target.outerHeight()-($overlay.outerHeight()-$overlay.height())}
$overlay.css($.extend({position:'absolute', zIndex:'1000', width:overlaydimenions.w, height:overlaydimenions.h, left:0, top:0, visibility:'visible'}, startpoint)).appendTo($target)
if (setting.opacity<1)
$overlay.css({opacity:setting.opacity})
$target.hover(
function(){
$overlay.dequeue().animate((setting.dir=="up" || setting.dir=="down")? {top:0} : {left:0}, setting.speed, 'easeOutExpo')
},
function(){
$overlay.dequeue().animate(startpoint, setting.speed)
}
) //end hover
})
}
})(jQuery);
</script>
<script>
jQuery(function($){ //on document.ready
$('#info').overlaycontent({ //initialize overlay on single DIV with id="info"
speed:500, //duration of animation in milliseconds
dir:'up' //supports 'up', 'down', 'left', or 'right'
})
$('div.imagecontainers').overlaycontent({ //initialize overlay on DIVs with class="imagecontainers"
speed:300,
dir:'right',
opacity:0.8 //opacity: 0 to 1
})
})
</script>
<style type="text/css">
div#summerinfo{
background:white;
padding:5px;
}
</style>
</head>
<body>
<div class="imagecontainers" data-overlayid="summerinfo" style="display:block-inline;width:200px;height:150px">
<img src="http://www.crestinfotech.com/wp-content/uploads/2015/05/crest-logo.png">
</div>
<div id="summerinfo">
<a href="http://www.crestinfotech.com">Useful Scripts</a><br />
<a href="http://www.crestinfotech.com">Beautiful and well designed</a><br />
<a href="http://www.crestinfotech.com">Latest technologies</a><br />
<a href="http://www.crestinfotech.com">www.crestinfotech.com</a><br />
</div>
<br/>
<div style="clear:both"></div><div><a target="_blank" href="http://www.crestinfotech.com"><span style="font-size: 8pt; text-decoration: none">Manish Wagh</span></a></div>
</body>
</html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
jQuery.extend(jQuery.easing, {easeOutExpo:function (x, t, b, c, d) { //see: http://gsgd.co.uk/sandbox/jquery/easing/
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
}
});
(function($){
$.fn.overlaycontent=function(options) {
var setting={id:'', dir:'up', speed:200, opacity:1}
return this.each(function(){
$.extend(setting, options, (this.getAttribute('data-overlayid'))? {id:this.getAttribute('data-overlayid')} : {})
var $target=$(this).css({position:'relative', overflow:'hidden'}) //set anchor DIV position to relative
var $overlay=$('#'+(setting.id)) //reference overlay DIV box
var startpoint={}
if (setting.dir=="up" || setting.dir=="down"){ //set initial position of overlay box (either "top" or "left" property affected)
startpoint={top:$target.outerHeight()* (setting.dir=="down"? -1 : 1)}
}
else{
startpoint={left:$target.outerWidth()* (setting.dir=="right"? -1 : 1)}
}
var overlaydimenions={w:$target.outerWidth()-($overlay.outerWidth()-$overlay.width()), h:$target.outerHeight()-($overlay.outerHeight()-$overlay.height())}
$overlay.css($.extend({position:'absolute', zIndex:'1000', width:overlaydimenions.w, height:overlaydimenions.h, left:0, top:0, visibility:'visible'}, startpoint)).appendTo($target)
if (setting.opacity<1)
$overlay.css({opacity:setting.opacity})
$target.hover(
function(){
$overlay.dequeue().animate((setting.dir=="up" || setting.dir=="down")? {top:0} : {left:0}, setting.speed, 'easeOutExpo')
},
function(){
$overlay.dequeue().animate(startpoint, setting.speed)
}
) //end hover
})
}
})(jQuery);
</script>
<script>
jQuery(function($){ //on document.ready
$('#info').overlaycontent({ //initialize overlay on single DIV with id="info"
speed:500, //duration of animation in milliseconds
dir:'up' //supports 'up', 'down', 'left', or 'right'
})
$('div.imagecontainers').overlaycontent({ //initialize overlay on DIVs with class="imagecontainers"
speed:300,
dir:'right',
opacity:0.8 //opacity: 0 to 1
})
})
</script>
<style type="text/css">
div#summerinfo{
background:white;
padding:5px;
}
</style>
</head>
<body>
<div class="imagecontainers" data-overlayid="summerinfo" style="display:block-inline;width:200px;height:150px">
<img src="http://www.crestinfotech.com/wp-content/uploads/2015/05/crest-logo.png">
</div>
<div id="summerinfo">
<a href="http://www.crestinfotech.com">Useful Scripts</a><br />
<a href="http://www.crestinfotech.com">Beautiful and well designed</a><br />
<a href="http://www.crestinfotech.com">Latest technologies</a><br />
<a href="http://www.crestinfotech.com">www.crestinfotech.com</a><br />
</div>
<br/>
<div style="clear:both"></div><div><a target="_blank" href="http://www.crestinfotech.com"><span style="font-size: 8pt; text-decoration: none">Manish Wagh</span></a></div>
</body>
</html>
Comments
Post a Comment
Comment