Monday 27 December 2010

jQuery Vibrate plugin

Have you ever wondered if it is possible to simulate in jQuery a "vibrating" effect, applying it to your buttons or DIVS?

jQuery Vibrate Plugin is the solution: a very light JS plugin that allows to make your tags to vibrate at the speed you desire, with some interesting parameters to configure if vibration should be activated when mouse is over, or when the tag takes focus (e.g. an input field), or if you prefer it always vibrating but stopping when mouse is over.

Only 3.94 kB for a powerful effect that you must try!

Thursday 14 October 2010

How to center a UL tag

Have you ever tried to center a UL tag inside a DIV tag (e.g. a menu)?

Well, this is the best solution I found on the Internet, based on pure CSS:
<style>
.ul_container {
 float: right;
 position: relative;
 left: -50%;
 text-align: left;
}
.ul_container ul {
 list-style: none;
 position: relative;
 left: 50%;
 margin: 0 10px;
 -moz-padding-start: 0; /* for Firefox */
}
.ul_container ul li {
 float: left;
 position: relative;
 margin:0;
}
</style>

<div class="ul_container">
 <ul>
   <li>one</li>
   <li>two</li>
   <li>three</li>
   <li>four</li>
 </ul>
</div>

I hope it helps you

Saturday 26 September 2009

How to survive to 500 Internal Error

A website used by a PR company, after more than 900 articles imported, today had a new issue:
500 Internal Server Error

The first thing I thought was: maybe the article they posted was too long. They copy and paste by Word document, and there is a PHP filtering function that simplifies code in lighter HTML, deeply tested and working finely also in other projects.

I asked them to forward the original article, and it was not too long. Strangely, they said also they had posted other long articles in the past, without any issue. I looked for tips on the Internet, and I checked .htaccess file, configuration of server, but nothing. When I tried to post the article with only a paragraph, and adding a paragraph more for every new attempt, I was able to do it: but after a certain numbers of paragraph I had again that terrible message.

This convinced me that the issue was its width in bytes. Finally, I had an idea: could it depend on the encoding of the form? Well, I solved all as follows:
<form action="..." method="post" enctype="multipart/form-data">

Now it works!

Further reading: Forms in HTML documents