Randompic widget

Developing your own site or blog? With the Aviamagazine Randompic widget you can add a random Aviamagazine photo to your website or blog.

Embedding is easy, as you only need to copy two lines of code. It’s also possible to personalize the widget, and show for instance only military photo’s.

Do you like this article?


Live example

Insert the javascript reference in your sites header

                            <script type="text/javascript" 

Add the AMwidget div in your site where the widget should display, and your done.

                            <div id="AMwidget"></div>

A typical setup looks like this

                                <title>example page</title>
                                <script type="text/javascript" 
                                <h1>widget example</h1>
                                <div id="AMwidget"></div>

If your unable to insert the javascript reference in your header, for instance when you use an internet blog, it should be possible to place it anyware. Just make sure it’s placed in front of the div tag.

Additional parameters

It’s possible to alter the layout and content by supplying additional parameters. Three parameters can be supplied.

Object Description
settings.type "mil" or "civ". To display only military or civil photo's. Default is both.
settings.width Width of the widget in pixels. Default is 200 pixels.
settings.bordercolor A hex code of the border color, "#c0c0c0". "transparent" or a color name "green" is also valid. Default is dark gray.

To use one or all of the parameters, alter the header by adding the followings script before the widget javascript reference:

                        <title>example page</title>
                        <script type="text/javascript">
                            var settings = new Object();
                            settings.type = 'mil';
                            settings.width = 250;
                            settings.bordercolor = 'transparent';
                        <script type="text/javascript" src=""></script> 

Using this widget on your site? Please tell us about it.

You need to be logged in as Aviamagazine member or connected with Facebook to post a comment.