<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>javascript Archives - Cube Websites</title>
	<atom:link href="https://cubewebsites.com/tag/javascript-2/feed/" rel="self" type="application/rss+xml" />
	<link>https://cubewebsites.com/tag/javascript-2/</link>
	<description>web design and development</description>
	<lastBuildDate>Thu, 05 Jan 2012 19:58:24 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://cubewebsites.com/wp-content/uploads/2019/04/cropped-favicon-32x32.png</url>
	<title>javascript Archives - Cube Websites</title>
	<link>https://cubewebsites.com/tag/javascript-2/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How To Use Impress.Js</title>
		<link>https://cubewebsites.com/guides/how-to-use-impress-js/</link>
					<comments>https://cubewebsites.com/guides/how-to-use-impress-js/#comments</comments>
		
		<dc:creator><![CDATA[Cube Websites]]></dc:creator>
		<pubDate>Wed, 04 Jan 2012 22:37:13 +0000</pubDate>
				<category><![CDATA[Guides]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[impress]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tutorial]]></category>
		<guid isPermaLink="false">http://www.cubewebsites.com/blog/?p=374</guid>

					<description><![CDATA[<p>Yesterday, I wrote about Impress.js, an awesome JavaScript library for creating online presentations. Since posting online, I’ve had several people ask how exactly to use it, as there’s no set documentation on the actual project page.  This guide will help you get started and allow you to create a simple slideshow, but after completing it [&#8230;]</p>
<p>The post <a href="https://cubewebsites.com/guides/how-to-use-impress-js/">How To Use Impress.Js</a> appeared first on <a href="https://cubewebsites.com">Cube Websites</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Yesterday, I <a title="Impress.js – A JavaScript Presentation Library" href="http://www.cubewebsites.com/blog/development/javascript/impress-js-a-javascript-presentation-library/">wrote about Impress.js</a>, an awesome JavaScript library for creating online presentations. Since posting online, I’ve had several people ask how exactly to use it, as there’s no set documentation on the actual project page.  This guide will help you get started and allow you to create a simple slideshow, but after completing it please bear in mind that there’s so much more that can be done with it.  The only limit is your creativity!</p>
<p>This tutorial is available for you to <a href="https://github.com/cubewebsites/Impress.js-Tutorial" target="_blank">view and download on GitHub</a></p>
<p><strong>Requirements</strong></p>
<p>To see this tutorial in action, please use Google Chrome or Safari (or Firefox 10 or IE10).  Impress.js is not currently compatible with earlier versions of Firefox or Internet Explorer.</p>
<p><strong>Setup</strong></p>
<p>The first thing you want to do is create a new webpage.  Mine’s index.html and within it setup the basic head and body elements.</p>
<pre>&lt;!doctype html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;Impress Tutorial&lt;/title&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
    &lt;/head&gt;
    &lt;body&gt;

    &lt;/body&gt;
&lt;/html&gt;</pre>
<p>Add the impress.js file before the end of the body element.  This imports the Impress library into your project</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode">&lt;script type=<span class="str">"text/javascript"</span> src=<span class="str">"impress.js"</span>&gt;&lt;/script&gt;</pre>
</div>
<p>Next we’ll create a wrapper which will contain the slideshow.  This is simply a &lt;div&gt; element with an id of ‘impress’</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">="impress"</span><span class="kwrd">&gt;</span>

<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<p><strong>Creating Slides</strong></p>
<p>Now you’ll see how easy it is to create a new slide in the presentation.  Each slide is a &lt;div&gt; element (within the wrapper) with a class name of ‘step’</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">="step"</span><span class="kwrd">&gt;</span>
    My first slide
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
</div>
</div>
<p>Whilst that creates a simple slide, things are a lot more fun you start adding data properties to your slides.  Data attributes signify properties of your slide for when it’s NOT the active slide.  The following data properties are available to you:</p>
<ul>
<li><span style="color: #404040;">data-x = the x co-ordinate of the slide</span></li>
<li><span style="color: #404040;">data-y = the y co-ordinate of the slide</span></li>
<li><span style="color: #404040;">data-z = the z co-ordinate of the slide (how far/close it appears to the user)</span></li>
<li><span style="color: #404040;">data-scale = scales your slide by a factor of this value.  A data-scale of 5 would be 5 times the original size of your slide</span></li>
<li><span style="color: #404040;">data-rotate = rotates your slide by the specified number of degrees</span></li>
<li><span style="color: #404040;">data-rotate-x = For 3D slides.  This is the number of degrees it should be rotated about the x-axis.  (Tilt forward/lean back)</span></li>
<li><span style="color: #404040;">data-rotate-y = For 3D slides. This is the number of degrees it should be rotated about the y-axis (swing in from the left/right)</span></li>
<li><span style="color: #404040;">data-rotate-z = For 3D slides. This is the number of degrees it should be rotated about the z-axis</span></li>
</ul>
<p><strong>Data Attributes In Action</strong></p>
<p>The following slide configuration will guide you through each of the data attributes in action.</p>
<p>Let’s start with an initial slide.  This slide has it’s x and y data attributes set to 0, so will appear in the center of the page.</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">="step"</span> <span class="attr">data-x</span><span class="kwrd">="0"</span> <span class="attr">data-y</span><span class="kwrd">="0"</span><span class="kwrd">&gt;</span>
    This is my first slide
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
</div>
<p>The second slide will have an x position of 500, but the y position of 0.  This means that it’s going to have to come in 500 pixels across the x-axis (slide left) when it becomes active.</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">="step"</span> <span class="attr">data-x</span><span class="kwrd">="500"</span> <span class="attr">data-y</span><span class="kwrd">="0"</span><span class="kwrd">&gt;</span>
    This is slide 2
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
</div>
<p>Easy huh?  The next slide will start with the same x-position as slide 2, but a y position of –400.  This will slide in from the top 400 pixels.</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">="step"</span> <span class="attr">data-x</span><span class="kwrd">="500"</span> <span class="attr">data-y</span><span class="kwrd">="-400"</span><span class="kwrd">&gt;</span>
    This is slide 3
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
</div>
<p>Slide 4 uses the scale value to show how a slide can appear to zoom in/out.  It has a scale value of 0.5, meaning that it’s half the size it should be.  When it becomes active the presentation will adjust the scale of ALL the slides by the factor required to make the scale of the active website 1.  What this means in this example is that for this slide to display normally (scale value 1) it will need to be scaled up by a factor of 2 (0.5*2 = 1).  All the other slides will also be scaled up by a factor of two, and become twice the size.</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">="step"</span> <span class="attr">data-x</span><span class="kwrd">="500"</span> <span class="attr">data-y</span><span class="kwrd">="-800"</span> <span class="attr">data-scale</span><span class="kwrd">="0.5"</span><span class="kwrd">&gt;</span>
    This is slide 4
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
</div>
<p>The rotate attributes allows you to rotate a slide into view.  Slide 5 is set to rotate by 90 degrees.</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">="step"</span> <span class="attr">data-x</span><span class="kwrd">="0"</span> <span class="attr">data-y</span><span class="kwrd">="-800"</span> <span class="attr">data-rotate</span><span class="kwrd">="90"</span><span class="kwrd">&gt;</span>
    This is slide 5 and it rotates in.
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
</div>
<p>Finally, for a 3D transition, you can specify rotate attributes for each dimensional axis (x,y,z).</p>
<p>The x axis is the horizontal axis.  This means that you can make things tilt forwards (positive value) or backwards (negative value).<br />
The y axis is the vertical axis so you can have things swing in from the left (negative value) or right (positive value).<br />
The z axis is the depth axis (the one coming out at you) so rotating things on this would be rotating things up (negative value) and down (positive value).</p>
<p><strong>Combinations</strong></p>
<p>Now that you know all about the data attributes, which is really all you need to animate your slideshow, you can use your imagination to combine these in weird and wonderful ways to create your own style of slideshow.</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">="step"</span> <span class="attr">data-x</span><span class="kwrd">="-2600"</span> <span class="attr">data-y</span><span class="kwrd">="-800"</span> <span class="attr">data-rotate-x</span><span class="kwrd">="30"</span> <span class="attr">data-rotate-y</span><span class="kwrd">="-60"</span> <span class="attr">data-rotate-z</span><span class="kwrd">="90"</span> <span class="attr">data-scale</span><span class="kwrd">="4"</span><span class="kwrd">&gt;</span>
    This is slide 7 and it has a 3D transition AND a scale.
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
</div>
<p><strong>Unsupported Browsers</strong></p>
<p>Impress automatically detects whether or not a browser supports it or not, and if it doesn’t then automatically adds a class name called ‘impress-not-supported’ to the wrapper ‘&lt;div&gt;’.  Using some CSS we can show a message to people on browsers which aren’t supported by Impress.</p>
<p>At the start of your &lt;div id=”impress”&gt; add the following:</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">class</span><span class="kwrd">="no-support-message"</span><span class="kwrd">&gt;</span>
    Your browser doesn't support impress.js.  Try Chrome or Safari.
<span class="kwrd">&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
</div>
<p>Then, create a stylesheet or add this to your existing stylesheet:</p>
<div id="codeSnippetWrapper" class="csharpcode-wrapper">
<pre id="codeSnippet" class="csharpcode"><span class="cls">.no-support-message</span> { <span class="kwrd">display</span>:<span class="str">none;</span> }
<span class="cls">.impress-not-supported</span> <span class="cls">.no-support-message</span> { <span class="kwrd">display</span>:<span class="str">block;</span> }</pre>
</div>
<p>This hides the message by default, but then displays it to browser if the impress-not-supported class is present.</p>
<p><strong>Have fun!</strong></p>
<p>This tutorial covers the fundamentals of using Impress.js to create your very own online presentation.  The entire example is available on Github for you to download and play with.</p>
<p><a href="https://github.com/cubewebsites/Impress.js-Tutorial" target="_blank">View on GitHub</a></p>
<p>The post <a href="https://cubewebsites.com/guides/how-to-use-impress-js/">How To Use Impress.Js</a> appeared first on <a href="https://cubewebsites.com">Cube Websites</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cubewebsites.com/guides/how-to-use-impress-js/feed/</wfw:commentRss>
			<slash:comments>32</slash:comments>
		
		
			</item>
		<item>
		<title>FREEBIE: YouTube Console</title>
		<link>https://cubewebsites.com/development/freebie-youtube-console/</link>
					<comments>https://cubewebsites.com/development/freebie-youtube-console/#respond</comments>
		
		<dc:creator><![CDATA[Cube Websites]]></dc:creator>
		<pubDate>Tue, 27 Dec 2011 19:53:25 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[intercom]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[youtube]]></category>
		<guid isPermaLink="false">http://www.cubewebsites.com/blog/?p=292</guid>

					<description><![CDATA[<p>A couple of days ago I discovered Intercom.  An open-source JavaScript framework allowing anyone to create their own command-line application. I decided to try it out by creating a command line interface (CLI) for YouTube.  What does this mean you ask yourself?  Well, using this plugin you can browse YouTube but instead of using the [&#8230;]</p>
<p>The post <a href="https://cubewebsites.com/development/freebie-youtube-console/">FREEBIE: YouTube Console</a> appeared first on <a href="https://cubewebsites.com">Cube Websites</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>A couple of days ago I discovered <a href="https://github.com/twisterghost/intercom">Intercom</a>.  An open-source JavaScript framework allowing anyone to create their own command-line application.</p>
<p>I decided to try it out by creating a command line interface (CLI) for YouTube.  What does this mean you ask yourself?  Well, using this plugin you can browse YouTube but instead of using the website, you do it via a series of commands.  There&#8217;s no real advantage to it, it&#8217;s more just about doing it to prove that it can be done.</p>
<p><img decoding="async" title="YouTube Console" src="http://www.cubewebsites.com/blog/wp-content/uploads/2011/12/youtubeconsole1.jpg" alt="YouTube Console" width="690" height="462" /></p>
<p>You can play around with it on the <a href="http://www.cubewebsites.com/youtube-console">live demo page here</a></p>
<p>Features include:</p>
<ul>
<li>YouTube search</li>
<li>Search by username</li>
<li>Top Rated videos</li>
<li>Recently Featured videos</li>
<li>Most Viewed videos</li>
<li>Paginated results</li>
<li>Caching for great performance</li>
</ul>
<p>This application is free and open-source, so if you&#8217;re interested in making your own Command Line Application, then feel free to <a href="https://github.com/cubewebsites/intercom/tree/youtube">Fork it on GitHub</a>.</p>
<p>The post <a href="https://cubewebsites.com/development/freebie-youtube-console/">FREEBIE: YouTube Console</a> appeared first on <a href="https://cubewebsites.com">Cube Websites</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://cubewebsites.com/development/freebie-youtube-console/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
