Categories
CSS HTML jQuery Tutorials

Cross Fading images using CSS3 Transition

For Live Demo: Click here

HTML Code:

Cross Fading images using CSS3 Transition

Click me to toggle

Categories
C#

Find Factors of Given Number

Here is the C# Solution to find the factors of given number:

– To improve the Performance of finding Factors of a given Odd number, we can increment i in the for loop by 2 instead of 1.

 public List findFactors(int n)
        {
            List factors = new List();

            int max = Convert.ToInt32(Math.Sqrt(n));

            for (int i = 1; i <= max; i++)
            {
                if(n % i == 0)
                {
                    factors.Add(i);
                    if(i != max) // add square-root factors only once.
                        factors.Add(n/i);
                }
            }
            return factors;
        }
Categories
jQuery Tutorials

Find Empty Elements using JQuery

Following is the code to find empty elements from the webpage:

JQuery code:

$('*').each(function(){ if($(this).text() == ""){ //Empty Element found..! } });