Posts

Showing posts from September, 2013

Add a “Read More” Link using jQuery

The jQuery Expander Plugin is a simple little jQuery plugin to hide/collapse a portion of an element's text and add a "read more" link so that the text can be viewed by the user if he or she wishes Here’s a simple way to use this plug-in your HTML Declare div with class "readmore" or apply class "readmore" to any HTML element  <div class="readmore">      The Div Text Comes Here     </div> And add the following jquery code to head section of your HTML page <head> <title>Add Read More Link</title>       <script src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.4.min.js" type="text/javascript">     </script>     <script src="http://plugins.learningjquery.com/expander/jquery.expander.js" type="text/javascript">     </script>     <script type="text/javascript">         $(function () {             $('div.read

Add Remove Class to Make clicked anchor tag active Jquery

For anchor tags adding active class for selected tag and changing the styles is follows. HTML code. <div class="create_d rive">      <a href="#">Some Text</aui:a>                   <a href="#">Some Text</aui:a> </div> Here is the script   $(document).ready (function(){ $('.create_drive a').click(function(){ $('.create_drive a').removeClass('active'); $(this).addClass('active'); }); });

Differences between HTML4 and HTML5

Image
10 Differences Between HTML4 & HTML5 It’s going to be a while before HTML5 is the new standard and everything HTML5 has to offer is supported by all the important browsers. If you’re a web dev, what should you do? If you’re new to the game or you’re an old pro, you eventually have to ask yourself when and how to begin transitioning over. Perhaps the first thing that you should learn and keep in mind is exactly what the differences between the two are. Here are ten important differences between HTML4 and HTML5: 1. HTML5 Is a Work in Progress As cool as it is to  see what HTML5 can do for you,  it hasn’t been standardized like HTML4. You don’t have to worry about updating pages built using HTML4. It’s more than ten years old and it’s a set standard. If you jump into HTML5 with both feet, you’re going to be making updates. Elements and attributes are added and modified several times a year. Of course, this is dependent how much you depend on rich elements, but it’s 

Difference between window.onload and document.ready

The difference between  window.onload  and  document.ready  is as follows. The  ready  event occurs after the HTML document has been loaded, while the  onload  event occurs later, when all content (e.g. images) also has been loaded. The  onload  event is a standard event in the DOM, while the  ready  event is specific to jQuery. The purpose of the  ready  event is that it should occur as early as possible after the document has loaded, so that code that adds funcionality to the elements in the page doesn't have to wait for all content to load. Example: <script> function myFunction() { alert("Javascript Page load"); } $(document).ready(function() {     alert("Jquery Page load"); }); </script> In the example above"Jquery Page load" alert will load first and then "Javascript page load" alert loads.

Displaying User Image in VM File Liferay

To show the logged in user image in Velocity file(VM) use the following code. <img src="/image/user_male_portrait?img_id=$user.portraitId&amp;" alt="Test Test" width="25">