Tuesday, December 29, 2009

Rash That Feels Like Sunburn

WordPress + jQuery: jQuery

Today we will see an easy way to implement (from scratch
Wordpress theme, which allows users to enter an e-mail to a service
newsletter. Everything will be done with jQuery . What we are going
I developed it to create the new dynamic version of the site of the Xiu Zhen Dao method, which uses WordPress as CMS note: the widget in question is visible in the right sidebar, on any given page

In this case, to make life easier on us and users, there is only one field to be filled with your e-mail, and the widget fails to properly validate this field, such as ensuring that it is this the '@' and at least one point '.' (This will be detailed below):
( "Free Text or HTML). Here is my widget compiled: \u0026lt;div id="newsletter_form"> \u0026lt;fieldset> \u0026lt;input id = "email_news" name = "email_news" type = "text" value = "your e-mail" /> \u0026lt;input id="submit_news" type="submit" value="iscriviti" /> \u0026lt; ; / fieldset> \u0026lt;/ form> \u0026lt;/ div> The CSS used to format the form is almost negligible, because it takes little beyond what is already present in the style of the theme Wordpress, where generally the input box and buttons are already drawn up. This style can be inserted into the document . css main theme, or in any other style sheet included in the page where you will place the widget. / newsletter widget * * / #
newsletter_form # email_news
{width: 130px;} # # newsletter_form submit_news
{margin-top: 5px;
padding: 2px;
cursor: pointer;} # newsletter_form . catched {font-style: italic;}

class
. catched
we will need later in the message of success.
2. jQuery validation
's time to write the script validation: it is essentially identical to what I used in the previous post

, but more time to implement a validation for our field more professional e-mail (as it is the only we have, this time!)
  1. Here's what the script does: when the user clicks the button "subscribe" to check that the field has been filled in correctly. If this does not occur, the field turns red, or else send an email to the address entered and displays a success message.
  2. (function ($) { $ (document). Ready (function () {
  3. / / newsletter widget
$ ('# email_news'). Click (function () { $ (this). Attr ('value','');} )
$ ("# submit_news) . click (function () {
/ / var style error
errorclass
= {'background': '# ff435b', 'color': '# 000', 'borderColor': '# 000'}
/ / analysis of data entered
email_news var = $ ("input # email_news). val ();
var ln = email_news.length;
atpos var = var email_news.indexOf ("@");
 dotpos = email_news . lastIndexOf ("."); 

/ / Field validation e-mail
if ((atpos \u0026lt;1 )
Thanks! You have entered

newsletter
'). Append ('
'.) Hide ();
$ (' # message_news. Catched '). Html (email_news)
$ (' # message_news '). FadeIn (' slow '); }});
return false;}
) 

});
}) (jQuery);

let us look at the first part of the code:


The first statement (lines 5 -7) only serves to automatically clear the text field when the user clicks on it to write its data.

Line 9 catches the event click on the submit button to start the validation procedures.

Lines 12-16 define a CSS class that is used to change the appearance of the input field in error.
The field validation e-mail to check that the entered data meets the following conditions:

must not be null Must contain at least one character '@' and at least one point '.'
The character '@' should not be given at the beginning of the quote
Point '.' must be at least one character away after the '@' but can not stand last.

To do this, first of all, it stores the data entered by the user by the method
 
val ()

, and then examines:


it calculates length by the method



length (line 20)

it locates the '@' character by the method

indexOf ()

(line 21)

you locate the position of the last period '.' inserted by the method

lastIndexOf ()

(line 22).

At this point, you can validate: the conditions are all alone sufficient to make an incorrect e-mail, and are connected by an OR (

if it is in first position, with the control
atpos \u0026lt;1
you see now is if '@' or if there is first

With
dotpos - atpos \u0026lt;2
we made sure that '@' and ' '. not be consecutive, and that the last '.' to the right of '@'

With the latter condition,
dotpos
== ln-1, but if you check the '.' is in last place.
This validation is very similar to that suggested by
w3schools.com

in JavaScript Form Validation .


If the validation does not pass, the field turns red Apply the
. Errorclass
(line 26).

Everything that comes after concerns the transfer of data to a php script for sending e-mail, and has been addressed in detail in the post
form validation with jQuery
.
In essence, we use the method

$. Ajax
, which also allows us to display a success message, without having to reload this or other pages.
Noteworthy, this time, the inclusion of data stored in the message of success to you, confirming what he had inserted just insert a
    \u0026lt;span>
  1. with a class for it (in my case
  2. . catched
  3. ) and pass the stored value, by the method
  4. html (val)
(line 40).
  1. 3. PHP script
  2. The last thing you see is the script that sends e-mail, and now there's really
  3. minimal! I have written like this:
  4. \u0026lt;?
php $ body = "e-mail writing". $ _POST ['Email_news']; $ header = "From:". $ _POST ['Email_news' ] mail ("indirizzo@email.dominio", "widget Newsletter", $ body, $ header); ?>
  1. 4. files to include
  2. summary, after inserting the HTML code widget (1 above), you must enter a jQuery script file that we have seen above (Section 2) in the header.php template (and at least in the \u0026lt;head> of each page that will display the widget), for example like this:
  3. \u0026lt;script type="text/javascript" src="newsletter_validation.js"> \u0026lt;/ script> Then you have to put the php script at the address specified in the url of the method $.
  4. ajax (perhaps the most convenient place is an absolute URL after placing the file, for example in the theme directory Wordpress).

Sunday, December 6, 2009

How Can I Oil My Clippers

widget Newsletter: custom form validation

I could have titled this post "principles of form validation," because what we will see how it is possible to write a simple form validation script from scratch.
You can use the popular jQuery plugin called just
    Validation
  1. created by Jörn Zaeferrer , which adds in a very simple custom function to validate a form. We will not use this road here, but look closely at what the problems and needs which must be faced if we want to validate a form with jQuery, and you'll get the flexibility that results from a greater understanding. Our goal is to have a final form that is valid without the need to load another page and send an email formatted arbitrarily, and that while it is flexible enough to support changes to the general recipe. The example comes from the contact form that I have implemented the "sleek" Site www.bfelettrotecnica.it
  2. , and the base from which shall be equal to that proposed in this tutorial
  3. of
  4. Net Tuts + ( to the work of Eric
  5. ), and that the Board of reading, though, before you begin.

1. HTML markup
As you can see from the picture, the form contains many fields, many mandatory (but not all), a select, textarea, a radio and even two for a unique selection: allows the user to choose whether to represent an individual or a company, and fill out the fields that vary According to this choice.
Here is the code of the form:
\u0026lt;div id="contactform">
\u0026lt;form action="#" method="post"> \u0026lt;fieldset> \u0026lt;legend> Request Information \u0026lt; / legend> \u0026lt;ol> \u0026lt;li>
\u0026lt;input id = "private" type = "radio" value = "private" name = "type" /> \u0026lt;span class="radioin"> Private \u0026lt;/ span> /> \u0026lt;label for="nome"> Name * \u0026lt;i> \u0026lt; / i> \u0026lt;/ label> \u0026lt;input id="nome" name="nome" type="text" class="obb" /> \u0026lt;label id='nome_err' class='error'> ; enter your name \u0026lt;/ label> \u0026lt;/ li> \u0026lt;li> \u0026lt;input id = "company" type = "radio" value = "company" name = "type" /> \u0026lt;span class="radioin"> Company \u0026lt;/ span> /> \u0026lt;label for="azienda"> \u0026lt;i> Company Name * \u0026lt;/ i> \u0026lt;/ label> \u0026lt;input
id="azienda" name="azienda" type="text" class="obb" />
\u0026lt;label id='azienda_err' class='error'> Enter the name \u0026lt;/ label> \u0026lt;label for="referente"> Contact \u0026lt;i> * \u0026lt;/ i> \u0026lt;/ label> \u0026lt;input id="referente" name="referente" type="text" class="obb" />
\u0026lt;label id='referente_err' class='error'> enter the name of a contact \u0026lt; / label> \u0026lt;/ li>
\u0026lt;li style="margin-top: 15px;">
 \u0026lt;label for="indirizzo"> \u0026lt;i> Address * \u0026lt;/ i> \u0026lt; / label> \u0026lt;input 
id="indirizzo" name="indirizzo" type="text" class="obb"
/> \u0026lt;label id = 'indirizzo_err' class = 'error'> enter the address of \u0026lt;/ label>
\u0026lt;label style="width: 75px;" for="cap"> CAP \u0026lt;i> * \u0026lt; , / i> \u0026lt;/ label> \u0026lt;input
style="width: 50px" id="cap" name="cap" type="text" class="obb"
/> \u0026lt;label id = ' cap_err 'class =' \u200b\u200berror '> enter the zip code \u0026lt;/ label>
\u0026lt;/ li>
\u0026lt;li> \u0026lt;label for="citta"> City \u0026lt;i> * \u0026lt;/ i> \u0026lt;/ label> \u0026lt;input
id="citta" name="citta" type="text" class="obb"
/> \u0026lt;label id = 'citta_err 'class =' \u200b\u200berror '> type the name of the city \u0026lt;/ label>
\u0026lt;label style="width: 75px;" for="provincia"> \u0026lt;i> Province * \u0026lt; / i> \u0026lt;/ label> \u0026lt;input style="width: 50px;" id="provincia" name="provincia" type="text" class="obb" /> \u0026lt;label id='provincia_err' class='error'> enter the province code \u0026lt;/ label>
\u0026lt;/ li> \u0026lt;li> \u0026lt;label for="telefono"> Phone \u0026lt;/ label> \u0026lt;input id="telefono" name="telefono"
type="text" /> \u0026lt;/ li>
 
\u0026lt;li>
\u0026lt;label for="email"> e-mail \u0026lt;i> * \u0026lt;/ i> \u0026lt;/ label>
\u0026lt;input id = "email" name = "email" type = "text" class = "OBB" /> \u0026lt;label id='email_err' class='error'> enter your e-mail \u0026lt;/ label> \u0026lt;/ li> \u0026lt;label for="area"> Area of \u200b\u200bInterest \u0026lt;/ label>
\u0026lt;select id="area" name="area"> \u0026lt;option value="void"> \u0026lt;/ option> \u0026lt;option value="centraline"> Control Unit \u0026lt;/ option> \u0026lt;option value="plc"> Programming PLC \u0026lt;/ option> \u0026lt;option value="Automazione"> Industrial Automation \u0026lt;/ option> \u0026lt;option
value="Quadri Elettrici"> Switchboards \u0026lt;/ option>
\u0026lt;option value = "Electrical Systems" > Electrical \u0026lt;/ option>
\u0026lt;/ select>
\u0026lt;/ li>
\u0026lt;li> \u0026lt;label for="messaggio"> Message: \u0026lt;i> * \u0026lt;/ i> \u0026lt; ; / label> \u0026lt;textarea id = "post" name = "message" rows = "5" cols = "38" class = "OBB"> \u0026lt;/ textarea> \u0026lt;label id='messaggio_err' class='error'> write the Your request \u0026lt;/ label> \u0026lt;/ li> \u0026lt;/ ol> \u0026lt;/ fieldset> \u0026lt;span id="input"> \u0026lt;input id = "submit" type = "submit" value = "Send Message" /> \u0026lt;/ span> \u0026lt;span style="font-style: italic;">
Personal data will be processed in accordance with privacy laws. \u0026lt;/ span>
\u0026lt;/ form>
\u0026lt;/ div> points worthy of note are:


the first line, action = "#" , because we will use jQuery to handle all of the part relating to the transfer of data php script that will send the final email.

tags
\u0026lt;label>
from class
 error are error messages that appear if the respective required field has not been completed. They are hidden by default. 

Required fields are denoted as usual with an asterisk (*), contained in a tag italics
\u0026lt;i>
, And class

OBB.

Tag
\u0026lt;div>
that has all the form will be required when viewing a success message to the user.


class "error" is dedicated to error messages, while the class "errorinput" is incorrectly filled fields. Need something that catches your eye, and in these cases the color of choice is red. I used something like this, passed through the CSS of the page:


.
error {color: red;
font-style: italic;
float: left;}

. Errorinput
{border: 1px solid red ;
background: # ffcbcb;
color: # 000;
margin-bottom: .5 em;}




property
float
I need the rows with two input tags, not to destroy the layout of the form.



2. jQuery: Form validation


2.0 basic validation


The first thing to do is hide the error messages and take possession of the event click on the submit button on the form, to perform our validation, instead of sending just the facts:


$ (document). ready (function () {$

(. 'error'). hide ();

$ ("# submit"). click (function () {

/ / here we go all the validation that is activated when the user wishes to send the message



}});


So far we are almost verbatim the tutorial
Net Tuts +
.

The validation is now expected to check each input field, and if it is empty, view the error message.

Net Tuts +
has only three fields, and then writes the validation function three times, once for each field: as I have

a lot of fields, I speed things up with a beautiful cycle.

First, you initialize a variable,
datastring
, which will contain all data to pass to the php mail script, and will be in the form:

datastring = [nome_campo_1 =] + [valore_campo_1] + [& nome_campo_2 =] + [valore_campo_2] + ... + [& Nome_campo_n =] + [valore_campo_n]
As per specifications of the GET method of php.
->
    Then, to analyze each element
  • \u0026lt;input> iterative method is used
  • each (callback)
  • : \u0026lt;input> for each tag (other than the radio button ' sending one or two of the top radio, and is not a disabled field, as discussed in paragraph 4 below) and for the textarea script must save two pieces of information: the value (with the data entered by the user), obtained by the method val ()
  • , and his ID. With this we now create the ID of the corresponding error message by adding the suffix "_err.
  • Here is the script for these first steps: $ ("# submit"). Click (function () {$
  • (. 'Error'). Hide (); datastring var = "";
$ ('input [id! = submit] [type! = radio], textarea, select'). not ('input [disabled]'). each (function (i)
{var val = $ (this). val ();
var id = $ (this). attr ("id");
var err = id + "_err"
});} 





I quote the statement that hides the error messages here to reset the validation each time you press the submit button.


Now, the validation in itself: if the field is empty (
val == ""
) and the field is required (ie, holding the class

OBB), you must do two actions: Assign error class "errorinput" (seen above) to tag \u0026lt;input>
to color it red,
view the error message, just manipulated by the ID.
If validation passes, it stores the data entered by appending the variable datastring
.

entering these operations, the cycle becomes complete as follows:
 
$ ("# submit"). Click (function () {var

datastring = "";

$ ('input [id! = Submit] [type! = radio], textarea, select '). not (' input [disabled] '). each (function (i)
{var val = $ (this). val ();
var id = $ (this .) attr ("id");
var err = id + "_err"

/ / error notification to the required fields
if ((val == "") & & ($ (this). is ( '. OBB')))
{$ (this). AddClass ('errorinput'). Focus ();
$ ("label [id =" + err + "]"). slideDown (); return true;} else {
$ ( this). removeClass ('errorinput'), / / \u200b\u200bremoval of protective class error

/ / storing data assessed if (i == 0) { datastring = id + '=' + val;} else { datastring datastring + = '&' + id + '=' + val;}

}});
 
}});

Monday, November 30, 2009

Gabriella Hall, Ultimate Attraction

Minimal poster design

I started to create a series of posters minimal, with the intention to communicate a single concept at a time, stripped of all decorative or technical complexity and aesthetic satisfaction of all superfluous.

The concepts that I try to express here are linked to Taoist philosophy, because they are well suited for the feature "simplicity" almost austere nature of the search back to the primary method of communication rather than other non-verbal and bare of tinsel .

And actually if we look at the figuativa original works of art in ancient China, they are especially loaded with fine details and very precise, and are far that minimal, to that effect. But their essence is not what is meant today when we talk about "design".


The Taoist philosophy which I associate myself here is that following the study
XiuZhenDao
method, for which I work, among other things, the web part. More or less the same days when I started this series, I found
powertotheposter.org (after having seen the very interesting documentary The Corporation
), and some of the jobs that are there have a concept behind of similar design.

For example, I converted a poster displayed therein

to express one of the most famous phrases of the Tao Te Ching:



The One gave birth to the Two, Three
the two generations, the Three
fathered the ten thousand creatures.

Tao Te Ching,
XLII











In my poster, the One is the white sheet, which divides the two, Yin and Yang, in their report that determines the three (represented by the wavy line that separates and unites them). The "ten thousand creatures", that is the essence of the manifested world, are the countless arrows, projected in all directions.

This links to the various cosmogonic myths, such as Prajapati who is torn to pieces and threw in every direction space, and in this case to the Chinese legend that says that the men were shaped by a pair of different colored sands of the Yellow River.


This poster is inevitably the first of the series.




Another tries to express the balance of a man who has joined with the harmony of nature, and portrays a character who sits quietly at the top of a mountain, regardless of the threatening clouds above him and below the ocean, which threatens to swallow.

As evidence of its balance, the fact that man is in the center, halfway between heaven and earth (as required by the Great Triad) to its natural place.

One of the most important concepts of Taoism is "empty": a poster tries to convey this concept using the famous metaphor of the cup, until it is empty can receive the tea. I refer here to the popular story of the Zen Master and man of science, which, not coincidentally, is also the first "101 Zen stories"



Nan-in, a Japanese master of the Meiji era (1868 -1912), was visited by a university professor who had come to him for questioning about Zen.

Nan-in served tea. He filled the cup of his host, and then continued to pour. The professor looked

spill the tea, then he could no longer contain himself. "It's filled. N'entra not there anymore! "

" Like this cup, "Nan-in said," you are as full of your opinions and conjecture. How can I explain the Zen unless you first empty your cup? "

101 Zen Stories, a

, ed. Piccola Biblioteca Adelphi






In this poster I picture my little teierina pot (the one I use for pu-erh tea pressed). All these posters, except the first, are hand-drawn, scanned, and then reassembled and "ink" digitally. To recreate the effect of inaccurate manual inking in Photoshop, I created the contours of the selections to color and then I edited with the command "refine edge" (alt + cmd + R) using the maximum values \u200b\u200bof cannot and expansion of the board.





Wednesday, October 21, 2009

Spongebob Birthday Clp Art

Post Romantic Empire Final Fest

This weekend, 17 and 18 October, I was in Rome as a special envoy to
gothicNetwork Final Fest of Post Romantic Empire
: a marathon of 30 hours of continuous music from 18 of Saturday to Sunday night at the 'Init
, local close of a Roman aqueduct and adjacent to the railway station Tuscolana. With so much room (or Dead Banquet
, as they said) Sunday based on various delicacies frugal and some delicious tomatoes datterini.
the music ranged from songwriting to dark


contemporary, with a massive presence of

experimental electronica, and a hint of improvisation and spontaneous creativity that is both independent event, unrelated to the currency more logical drives. However, soon there will be a special about gothicNetwork the Fest, and everything will be clear to everyone. In the meantime I wanted to share a dozen pictures taken during the event: a cheerful obituary black and pink by 'friendly and relaxed atmosphere

as few times I've heard in such cases, where artists and spectators were all together to enjoy the party.





















Friday, October 9, 2009

Wednesday, October 7, 2009

Pokemon Deluge Legendary Detector

Asleep, awake struggling to

reasoned analysis of an improvisation almost

Asleep, struggling to awake to
blacktealover
This piece was part of what creates a collaborative project abandoned visual art + music (for more information see
The theme of the piece defines the title
Asleep, awake struggling to : the sleep, the slumber
that you can not break and that occupies a large part of our lives. I mean not only, in fact, sleep at night, to rest more or less deserved (and often abused) in his bed or on the sofa, but rather to that feeling - sometimes subtle, sometimes almost tragic - to be asleep the face of reality, live the present moment so far, over a blanket of fog. Many authors Gurdjieff, the Buddha
, the Gospels ... In every age there have been men who have realized this and have been trying to overcome.
The song absolutely does not want to get to these heights, psychological, philosophical and spiritual! It was created in an hour or so on an impulse over-rational (as any real creative experiences), which only in retrospect I could bring these conceptual coordinates, according to the sensations felt during the creation of the piece and the subsequent replay .
The piece is very simple: only two lines electric guitar, including a "boundary". The first line, the most important, is based on a simple twist on the original single-note-The Lydian scale (fourth degree of I-). The stereo delay effect has been added to give a sense of estrangement and alienation, and is (more or less) time with the music. The first part of the piece is based on a simple rhythmic cadence, to give room for delay and to cultivate a sense of numbness, almost paralyzing, to move in a dense fog. The music does not progress, nor to be any resolution. The sequences of the agreements, very simple, they are cyclical and can be repeated indefinitely. That is the
the banal and boring repetition of this mode of existence: everything is repeated as in a drama that begins anew each time.
The only way to break this continuity is a flat resolution which seeks to break the cycles - and this is what happens at the 1:23 minute. Passing resolution and despair attempts were strengthened by the fact that the agreement is changed only after two strokes, resolving that in C major, with just a touch of difference to me-(Si passing to C rising by only one semitone) allows me to keep the same intensity of expression and aesthetics at the same time exploit the melodic passage to the sixth grade, always impressive.
All this short section should be really intense, and strong enough to take your breath away, because these moments you live like that. The slow cadence of accents highlights the difficulty of the attempt, and the great effort that entails. The agreements that follow it, are always strong, but much more sparse, due to fatigue and accumulated disillusionment.
This ultimately makes everything come back as before: the progressive and melancholic return to the initial theme that starts at 2:12 minutes symbolizes this very progressive riabbandonarsi sleep.
When you are asleep then, there is a short break and now incorporates the theme of "sleep" early, which brings the song to a conclusion. The second line was improvised on the guitar first, and consists almost exclusively of a note to me (especially the I twelfth button on the first string) played with a metronome to time different from the main line. In the section 2:12 of the third sound of the agreements (the note that determines the nature of "major" or "less" of an agreement) to play on emotion of the major / minor.
Both lines are improvised and were recorded in one take (I think the second), with an electric guitar connected directly to the soundcard.
effects were added after-effects: more like a stereo delay and a bit 'reverb.

Tuesday, October 6, 2009

How To Clean Your Rotolog

jQuery: Integration & Fancybox Tooltip

This post is the integration of two great jQuery plugin:
Fancybox - a clone of lightbox interface more attractive and with some well-implemented features,
title \u0026lt;a>

These two plugins are supposed to then have installed and configured. The purpose of this


hack is to have a gallery with Fancybox
image titles and links that can accommodate that show a "tooltip" : it is what I did for the gallery of graphic design on Nada- Design, where some images have a link to the page on deviantArt account . In order to understand the user that the deviantART link to a page I put a tooltip that shows the logo of the community.

The aim is to insert HTML in the title shown by Fancybox, and to thus attach a link and a tooltip, and at the same time to also validate the page as XHTML Strict!

1. Entering the link in the title picture The title of the image in the gallery Fancybox the attribute is extracted title of the link that launches the image itself, since title
supports as broad a text string value is possible, in line principle, insert HTML (obviously taking care to replace all special characters with their entity), for example:
\u0026lt;a href = "# img1.jpg" rel = "[fancybox]" title = " < a href = " _blank " link_esterno " target = " title = " title " > testo_link < / a > & quot; img > < / > \u0026lt;/ a> In practice, it inserted another tag \u0026lt;a> complete within the attribute
title.

The problem with this procedure is that the browser will interpret the attribute, however, and will display the default tooltip with all the information you have entered ... with a particularly disgraceful!






But since this is a feature not be disabled externally, there is nothing left to do but give up the title attribute

, and choose another, and this decision, of course, we greatly complicate the lives ...

We can not select the attribute id

, because it supports only unique values \u200b\u200bwithout special characters. So we choose the attribute

rev

: it, by definition
W3Schools
, "specifies the relationship between the linked document and the current document."

But the characteristics that we do choose are essentially two:

is not interpreted by any of the major browsers.
  • This means that we can put anything we want without noticing that the browser, and maintain the validity of the page. However, even if the document valid, you can not just talk about content standards compliant!
  • So in the end my name tag \u0026lt;a> have this: \u0026lt;a rel = "[fancybox]" rev = "< a href = " http://blacktealover.deviantart.com/art/Reincarnation-118622078" ; target = " _blank " title = ". " > reincarnation < / a > "title =" reincarnation "href =" images / graphics / large / reincarnation.gif "> \u0026lt;img width="160" src="images/graphics/reincarnation.gif" alt="reincarnation" height="80"/> \u0026lt;/ a>


The title of link "add" must not be empty if you want the tooltip to appear. 2. Hack Fancybox At this point you must go to modify the code to make him take the Fancybox rev attribute instead of

title as it does normally.
The changes are simple: we are interested in only the section of code from line 60 to 97 file- jquery.fancybox 1.2.1.js in particular we are going to replace line 63:
{var item = href : elem.href, title: elem.title};


with the following code:
if ($ (elem). attr ("rev")) {var item = {href
: elem.href, title: elem.rev}; } else {var item = {href: elem.href, title: elem.title};}

 and the line was originally 
78

item = {href: Subgroup [i]. href, title: Subgroup [i]. title}; with this:


if ($ (Subgroup [i]). attr ("rev")) {
item = {href: Subgroup [i]. href, title: Subgroup [i]. rev};} else {
The two code sections are respectively for a single image and a group of images.
I put the check on the existence of the attribute rev
why so if you decide not to put anything extra in the title of the image, Fancybox behaves as usual, going to fish the contents of the title . In this way, we do not burn the earth behind him. For the link works you should disable the option hideOnContentClick (found in the list of functions in the bottom of the script file) by setting up false
.

Now, to complete this first part dedicated to Fancybox, just go to draw our link with the CSS. The selector
    we are interested to go to hit the links in the title of the image is
  1. # fancy_title
  2. , for example: #
fancy_title
a {color: # f9c587;
text-decoration: none;} # fancy_title a: hover {color
: # fad5a7;
text-decoration: underline;}

 3. Entering the tooltip 
To invoke a tooltip when you place it on the link, the best way is to use the callback function
of Fancybox. In the bottom of the file Fancybox, jquery.fancybox-1.2.1.js
, let's enter the function that generates the tooltip, and we will call simply "fancyboxCallback. Let's declare
callback option:
callbackOnShow: tooltipCallback, and then, immediately below, the call:

tooltipCallback function () { $ ('# fancy_title a'). tooltip ({track : true ,
delay: 0, fade
50,
 ShowURL: false, 
fixPNG: true,
extraClass "datip"
bodyHandler: function () {return $
(
). attr ({src
: "balloon_da.png" 
width: "30",
height: "33"
});}
,
top: -40, left
: 0
});} ;

Line 2 defines the element that we create this tooltip; attribute is important
 extraClass 
, we will use later to assign basic properties, and the function passed through
bodyHandler
. With this parameter you can inject any HTML in the tooltip, in this case the block is filled with an image.

In my case, I do not want the tooltip displays the text of
 
title of my link, but a single image (the same for this gallery) that represents the logo of deviantART. Step in the attributes that the tag
\u0026lt;img />
is the image created earlier (+ Its size).

Finally, we develop a class dedicated
datip
: it fits into the file jquery.tooltip.css and in my case is: #

tooltip.datip {background: 0; width: 30px; height: 33px; padding: 0;}

# tooltip.datip img {position: absolute; top: 0; left: 0;}

The first part of the CSS code eliminates any background generic tooltip of this page and set the exact dimensions of the image that will be inserted in the block.
The second part concerns the content of the tooltip, which in this case is an image, and used to obtain a perfect placement. is obvious, given the versatility of the Tooltip, and the way in which we modified Fancybox general, which in principle can have fun by entering the title of a variety of HTML and show tooltip with more of everything, for example an extended caption with lots of text and / or images, or otherwise.

As usual, the limit is your imagination and creativity of each.
 

Thursday, October 1, 2009

How Long Can A Stomach Virus Last

a traveler's guide in seven steps




a
Aim Beyond



Nothing is ever too far away. If you aim for the stars may reach only a lamppost, but at least you fall away from the ground. There distances that are not deserving of being covered.


2
Always flow spontaneously
 



 



How does the water, follow the way of nature. Do not think too much, the opportunities do not wait.



The water is never idle, day or night. [...] If you oppose a dam, it stops, if you open a closed flow. It adapts to any container, whether it be round, square, or some other form.
Ko Chang Sheng, comment on ch. VIII of the Tao Te Ching





3
Follow the signs in the stars





Let surprised if you: Do not force your point of view, change your plans. Marvel without fear.

4 Find solace in movement

 





Fa 'that the movement is your rest and your comfort. Gioscia of the world as it passes in front of your face.



5
Look for Crossroads and singularities



's unusual is a perennial source of delight for the traveler. It stimulates the unexpected Looking for suitable conditions, and strengthens your ability to adapt.
6
Wear out your shoes



7 Never give up



Behind every corner is a delight unknown. The fatigue does not interest us: if we are walking, we are sleeping, in both cases, it is dream or reality, we are traveling. Or at least we are drinking a beer.
These photos were all taken during one trip. The concepts that accompany them, however, always apply at any time and everywhere: they are principles that inspire many of my actions. Do I have to come up with the metaphor of life as a journey stravecchia? What a bore, always philosophizing on the same hackneyed ideas ... these little tips just want to be something concrete, so it will fully enjoy the journey itself, without wasting too much time thinking about it. That opportunities come back too, but after a lot of time.