Easy way to automatically resize large images Get link Facebook Twitter Pinterest Email Other Apps January 10, 2012 div.banner img { max-width: 500px; width: expression(this.width > 500 ? 500: true); } Get link Facebook Twitter Pinterest Email Other Apps Comments
PHP: Date Difference for PHP 5.2 August 22, 2015 function days_diff($d1, $d2) { $x1 = days($d1); $x2 = days($d2); if ($x1 && $x2) { return abs($x1 - $x2); } } function days($x) { if (get_class($x) != 'DateTime') { return false; } $y = $x->format('Y') - 1; $days = $y * 365; $z = (int)($y / 4); $days += $z; $z = (int)($y / 100); $days -= $z; $z = (int)($y / 400); $days += $z; $days += $x->format('z'); return $days; } // Call function $start_date = '2015-08-19 15:18:19'; $end_date = '2015-08-22 15:18:19'; $date1=date_create(date('Y-m-j',strtotime($start_date))); $date2=date_create(date('Y-m-j',strtotime($end_date))); $diff=date_diff($date1,$date2); echo $diff; Read more
HTML5 video loop src change on end play function February 21, 2014 1. HTML <video id="homevideo" width="100%" autoplay onended="run()"> <source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4" /> </video> <ul> <li>http://www.w3schools.com/html/mov_bbb.mp4</li> <li>http://www.w3schools.com/html/movie.mp4</li> </ul> 2. CSS <style type='text/css'> ul { display:none; } </style> 3. jQuery <script type="text/javascript"> video_count = 0; videoPlayer = document.getElementById("homevideo"); function run(){ video_count++; var countVideo = $('li').length; if (video_count == countVideo) video_count = 0; var nextVideo = $('li').eq(video_count).text(); videoPlayer.src = nextVideo; videoPlayer.play(); }; </script> Working Demo Read more
display the_content with setup_postdata June 29, 2010 <?php global $more; $cat= 3; $posts = get_posts ("cat=$cat&showposts=5"); if ($posts) { foreach ($posts as $post): $more = false; setup_postdata($post); ?> <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> <p class="storycontent"><?php the_content('Read more...'); ?></p> <?php endforeach; $more = true; } ?> Read more
Comments
Post a Comment