Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Friday, 7 August 2009

TIP - Zoomers

email me

I have another Blog called Paradise Discovered which is not constrained by the content I have elected to post on this site. But it doesn't mean that I do not use all the 'tips-n-tricks' I throw up here. Indeed, anything I mention here can almost certainly be found in use on the other Blog. Makes sense, huh?

I recently found myself hunting through the Formula One Official Website looking for information on the freak accident that racing driver Felipe Massa suffered during the second qualifying session (Q2) in Hungary on Saturday, 25th July 2009.

I was lucky. They had a fairly detailed explanation of the 'what', 'when' and 'where', and even had an artist's interpretation of what had probably happened. The TV cameras had caught the incident, but it all happened so fast that it was impossible to tell precisely how things had panned out. I am sure that there were other cameras trained on the event that the officials studied in great depth. The point is that the graphic was so tiny that it was impossible to make out some of the points (arrows) that the explanation invited the reader to look at.

That's when it occurred to me that a 'zoomer' window that allowed the viewer to see parts of the original small graphic 'enlarged' in another window would have been a nice touch. So I went looking for a script, preferably FREE, that would accomplish the task on a blog post.

I struck pay dirt on my first search. In fact I found a page that listed FIVE 'zoomer' scripts, four of them FREE! Some are pretty geeky, and I've discounted the paid-for script, which left me with 'MojoZoom' as the clear favourite for use on a Blogger platform.

reminder

(reminder to self - must remember to make a small PayPal donation to the author!) - DONE!

The script requires you to be able to host the JavaScript (.js) and CSS (.css) files on a server, but if you wish to use the script, I can provide that hosting - free of charge! All you will need to do is to point the link to the one I provide you with, and you're good to go!

I will give you the details in the next post, but here is an example of what you can expect. The image on the left is the album cover of the iconic Beatles album, 'Sgt Peppers Lonely Hearts Club Band', which was ground-breaking when it was first published for using 'pop art' in preference to images of the band or individuals. In short, I used this image because it is busy, busy, busy!

Simply run your mouse cursor over the pic to see a magnified version of the area under the cursor that will appear in a hidden window to the right of it almost like magic ...

 

 

If you think you can make use of this bit of JS-magic on your own blog, come back for the detail in the next post.

Watch this space ...

back to the top

 

Saturday, 16 May 2009

TIP - WLW Exposed

email me

I have spent some time exploring the many attributes of 'Windows Live Writer' and it continues to surprise me with its versatility.

Your needs will probably NOT be as demanding as mine (I'm a 'geek' who likes to push the envelope), but even for the simplest of tasks, like putting up a new post, this little gem is going to make your life so EASY that when you start to use it you'll wonder how you managed without the darn thing!

This is truly a WYSIWYG editor of unparalleled excellence, because you actually type into the space allocated to you by your blog template. So, what you see in the window is exactly what you get when the post is published. You can format your paragraphs with the alignment of your choice, 'left', 'right', 'centred' or 'justified' (as this post is). It spell-checks as you type, underlining your spelling mistakes just like a word processor does, so there is no longer any excuse for those hilarious 'typos'. You can even select to  'bold', 'italicise', 'underline', 'strikeout' or 'change the colour of the font' on the fly.

What's not to like about that?

And none of this requires you to get your hands dirty with HTML and CSS. The programme does it all for you, although, in its typical Microsoft way the code produced isn't necessarily 'standards compliant'. But I don't suppose you care about that little nicety if you are an 'average' blogger. You should, but I won't hold it against you!

If you haven't already tried it out you're probably wondering what all the hype is about. So I suppose a couple of graphics are in order. I haven't planned any of this, so I shall post and edit, look at how things are being displayed, change formatting to 'present' the post as I'd like it to be presented, then click on the button that says 'Publish', and it is done …

 

SnagIt capture of the WLW start page

I use 'SnagIt' almost exclusively for my screen captures and this programme comes with a plug-in that allows me to use SnagIt directly from this window. That's a 'wooo-hooo' for me!

 

WLW Edit window showing history and add-ons

Of course, the graphics 'sizing', 'placement' and 'effects' are far superior to anything I've seen in any other WYSIWYG editor. And the three little tabs at the bottom of the window, 'Edit', 'Preview' and 'Source' do exactly what they are intended to. 'Edit' is the pane I've shown in the screen captures above. 'Preview' is a preview of your post as it would appear on your site, including banners and sidebars. 'Source' shows you the HTML source code, something I am very grateful for as it gives me a chance to insert the little 'extras' that aren't included. I still have to investigate whether little bits of JavaScript and other HTML formatting can be added to the programme, but if it can't I am not going to get bent out of shape about it.

 

WLW Edit window (bottom) showing additional features

The graphic above is there to emphasise the 'power' of the various features of the programme. When you set up the 'Options' tell the programme to not allow you to publish until it reminds you to add a label or two. You still have the choice of publishing a post without a label, so it will only remind you, not refuse to publish. You can also defer publication date, just like you would do in Blogger, but the option is there for you if you wish to use it.

When I discover more, I'll let you know.

Enjoy, really enjoy, your blogging …

 

back to the top

 

Sunday, 16 December 2007

TIP - Mouseover Fun

email me

A comment left on David McMahon's Blog by the blogger david of David's "Images of Nature" Photography Gallery fame, asked how the 'Mouse-over' effect was done on the "Invitation" graphic used on David McMahon's page.

It is a simple Javascript function that anybody can use, so here are some quick instructions on how to achieve it. And since david asked, I trolled across to his site and stole one of his graphics to best illustrate what I am about to do!

 


 

1. It isn't necessary to backup your template as you aren't going to touch that side of things!

 


 

2. Choose the image you want to display as the permanent image. Do all the image editing you need to display it at its best. One good idea is to give the image a border, one that you will use again in the second image (see below), so that the mouseover transition appears seamless. Try and make it a reasonable size for the display space of your page, but in any event Blogger will give you the best fit when you upload the image.

2a. Now select the image you want to use as the alternative (or mouseover image) and make sure you crop it to exactly the same size as the previous one. If you used a 'frame' of any description make sure that that frame is also used for the second image.

Here are the two images I intend to use, cropped, edited and framed:

 

 


 

3. I have decided that the picture of the Purple tulips is the one that will appear as the 'static' image and that the Pink tulip will appear as the alternative, or 'rollover', image.

Open a NEW post. You will not be publishing this one, and will eventually delete it after first saving it as a draft. It is only to help you upload your images and get the code that is returned.

 

 

 

 


 

4. Here is the code for the two images you uploaded. Make a note of the bits I have highlighted. That is what you will eventally copy to your actual post, totally ignoring the rest of the Blogger code. You don't want the displayed image to be 'clickable', and for it to open up in a new window. That would sure spoil the effect you are trying to achieve!

 

 

 


 

5. All that remains to do is to add the Javascript to 'envelope' the two images, or add the pic URL's to the Javascript, depends on how you see it. And here it is:

 

<table align="center"><tr><td align="center">
<img onmouseover="Javascript: this.firstsrc=
this.getAttribute('src'); this.secondsrc=
'http://bp0.blogger.com/_fV9I2C_dAUY/R2Wrh1GGLRI/
AAAAAAAAASM/pn8sq1dh8vc/s400/tulip_pink_round_blu.
gif'; this.setAttribute('src',this.
secondsrc);" onmouseout="Javascript: this.setAttribute
('src',this.firstsrc);" alt="" src='http://bp2.blogger
.com/_fV9I2C_dAUY/R2WrhVGGLQI/AAAAAAAAASE/
gPIt_Eq88zw/s400/tulip_purple_round_blu.gif' />
</td></tr></table>

 

Some things to draw to your attention:

  • You can actually copy/paste the code from the box and save it somewhere, preferably in the [ Settings | Formatting | Post Template ] area of your Admin page (see this previous post).
  • The SECOND (rollover, mouseover, whatever) picture link is the first one to appear in the script; the FIRST (static) picture link is included as the second link reference - (hey, it's not me being difficult - it's the way the script works!).
  • You must (duhhh, obviously!) change the pic URL links in the script to the ones returned by Blogger when you upload your own pics.
  • It is IMPORTANT that you make sure that the quotation marks that surround the URL links are single ( ' ) and not double quotes ( " ), as this has a relevance on how the script is executed.

 


 

So, did I manage to successfully tip-toe through david's tulips? Let's have a look:

 

 


 

Looks okay to me. I guess it's your turn now ...

back to the top

 

Saturday, 19 May 2007

Leap of Faith . . . Editing your template for Thickbox

This is your 'leap of faith'. This is where you have to make a decision as to whether stepping out into the unknown is worth the end result. I have shown you what you can achieve; you have to decide whether it is worth the effort. I will hazard a guess that most of you decide that it probably is!

So, let us make a start.

---------------------------------------------------------------------------------

1. Call up your page in a new window and check that you're 'signed in'. You should now have this tutorial and your homepage open, either as two separate windows or two tabs (IE7 or Firefox or whatever), and you will need to switch between windows to complete the various steps I will outline.

---------------------------------------------------------------------------------

2. Click on 'Customize' (I vill zay zis only vunce - all editing is being done on YOUR page!).

---------------------------------------------------------------------------------

Choose to edit the  HTML - (click on the thumbnail for a larger image)

3. Choose to 'Edit HTML' when you are faced with these choices.

---------------------------------------------------------------------------------

Save your template - (click on the thumbnail for a larger image)

4. Save your template (but see below) . . .

---------------------------------------------------------------------------------

My preference for saving a template - (click on the thumbnail for a larger image)

5. My preference for saving a template is to copy the template from the editing window by positioning the cursor in the window, pressing 'Ctrl+A', then 'Ctrl+C' (this will select all the text in the window and copy it to the clipboard). Now paste the copied text into your text editor (Notepad or one of the editors I've recommended previously), by opening it and pressing 'Ctrl+V'. Then SAVE that as a text file, with a name you can recognise easily, and in a place that, if you need to, you can find it quickly.

Note: do NOT use a word-processing package like 'Word' as this will corrupt the text you've just saved. For the 'geeky', the difference is between UTF-8 and UTF-16, but that's another story for another time!

---------------------------------------------------------------------------------

6. Find the last 'close brace' above the '</head>' tag. You could scroll down (see image), but the easiest way is to click the 'Edit ---> Find on this page' link in your browser and type '</head>' (without the quotes) into the box and click 'Next'.

---------------------------------------------------------------------------------

7. Insert two or three returns between the curly bracket and the line that reads "]]></b:skin>". If your template doesn't have this line, insert the following code just above the '</head>' tag and it will still work! Copy & paste the code in the box:


/* ----- thickbox settings ----- */

#TB_window {
font: 12px Arial, Helvetica, sans-serif;
color: #333333;
}

#TB_secondLine {
font: 10px Arial, Helvetica, sans-serif;
color:#666666;
}

#TB_window a:link {color: #666666;}
#TB_window a:visited {color: #666666;}
#TB_window a:hover {color: #000;}
#TB_window a:active {color: #666666;}
#TB_window a:focus{color: #666666;}

#TB_overlay {
position: fixed;
z-index:100;
top: 0px;
left: 0px;
background-color:#000;
filter:alpha(opacity=75);
-moz-opacity: 0.75;
opacity: 0.75;
height:100%;
width:100%;
}

* html #TB_overlay { /* ie6 hack */
position: absolute;
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
}

#TB_window {
position: fixed;
background: #ffffff;
z-index: 102;
color:#000000;
display:none;
border: 4px solid #525252;
text-align:left;
top:50%;
left:50%;
}

* html #TB_window { /* ie6 hack */
position: absolute;
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}

#TB_window img#TB_Image {
display:block;
margin: 15px 0 0 15px;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc;
border-top: 1px solid #666;
border-left: 1px solid #666;
}

#TB_caption{
height:25px;
padding:7px 30px 10px 25px;
float:left;
}

#TB_closeWindow{
height:25px;
padding:11px 25px 10px 0;
float:right;
}

#TB_closeAjaxWindow{
padding:7px 10px 5px 0;
margin-bottom:1px;
text-align:right;
float:right;
}

#TB_ajaxWindowTitle{
float:left;
padding:7px 0 5px 10px;
margin-bottom:1px;
}

#TB_title{
background-color:#e8e8e8;
height:27px;
}

#TB_ajaxContent{
clear:both;
padding:2px 15px 15px 15px;
overflow:auto;
text-align:left;
line-height:1.4em;
}

#TB_ajaxContent.TB_modal{
padding:15px;
}

#TB_ajaxContent p{
padding:5px 0px 5px 0px;
}

#TB_load{
position: fixed;
display:none;
height:13px;
width:208px;
z-index:103;
top: 50%;
left: 50%;
margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
}

* html #TB_load { /* ie6 hack */
position: absolute;
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}

#TB_HideSelect{
z-index:99;
position:fixed;
top: 0;
left: 0;
background-color:#fff;
border:none;
filter:alpha(opacity=0);
-moz-opacity: 0;
opacity: 0;
height:100%;
width:100%;
}

* html #TB_HideSelect { /* ie6 hack */
position: absolute;
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
}

#TB_iframeContent{
clear:both;
border:none;
margin-bottom:-1px;
margin-top:1px;
_margin-bottom:1px;
}

/* ----- end of thickbox settings ----- */

/* ----- start of Terry's settings ----- */

.img_left { /* terrys hack */
float: left;
margin-right: 20px;
margin-bottom: 6px;
}

.img_right { /* terrys hack */
float: right;
margin-left: 20px;
margin-bottom: 6px;
}

.clear { /* terrys hack */
clear: both;
}

.dropcap { /* terrys hack */
font-family: times;
color: #8CA3BB;
font-size: 70px;
float: left;
padding-right: 2px;
padding-top: 2px;
line-height: 60px
}

/* ----- end of Terry's settings ----- */

---------------------------------------------------------------------------------

8. This is what it should look like after you've pasted in the code. Still with me?

---------------------------------------------------------------------------------

9. Find the '</head>' tag again, then copy/paste the following code just above it:


    <script src='http://www.tapmal.com/thickbox/jquery.js' type='text/javascript'/>

    <script src='http://www.tapmal.com/thickbox/thickbox.js' type='text/javascript'/>

---------------------------------------------------------------------------------

10. This is what your template should look like after you've pasted in the relevant code.

A brief explanation: the code is telling the blogger engine where to find the JavaScript sources for the Thickbox to work. I have currently pointed it to my own server, which will always be available with the most up-to-date "js" scripts for this function. You see, I use this path as well, so you can be certain that as long as I am on the web, you don't have to worry about where to get your JavaScript or your animated 'loading' GIF.

---------------------------------------------------------------------------------

11. You can click on the 'PREVIEW' link, but you won't notice any change to how your blog displays, and that is because the bits of code we've put in don't actually change how your blog is displayed UNTIL you call the specific function. But more about that in the next post.

---------------------------------------------------------------------------------

Now 'SAVE' your template (you already have the original so you don't have to be too concerned) and 'View' your blog. No difference? Bravo! That means all the 'tweaking' you've done was completed successfully!

So far, so good! Now you just have to wait for the second part to see how to 'edit' each of your picture posts to achieve the 'Thickbox' effect.

Come back again, soon!

back to the top