<?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>Avivo Tech Blog &#187; jquery</title>
	<atom:link href="http://tech.avivo.si/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.avivo.si</link>
	<description>Solving problems</description>
	<lastBuildDate>Tue, 24 Jan 2012 14:46:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>JQuery problem with attr(&#8220;value&#8221;)</title>
		<link>http://tech.avivo.si/2011/03/jquery-problem-with-attr-value/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jquery-problem-with-attr-value</link>
		<comments>http://tech.avivo.si/2011/03/jquery-problem-with-attr-value/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 14:10:23 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[HTML, Javascript and CSS]]></category>
		<category><![CDATA[attr("value")]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery error]]></category>
		<category><![CDATA[jquery get attribute value]]></category>
		<category><![CDATA[jquery problem with attr("value")]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1228</guid>
		<description><![CDATA[We experienced a problem using attr(&#8220;value&#8221;) JQuery function when selecting values that are not integers. So if you have: &#60;ul&#62; &#60;li id="li1" value="1"&#62;One&#60;/li&#62; &#60;li id="li2" value="2"&#62;Two&#60;/li&#62; &#60;li id="li3" value="3"&#62;Three&#60;/li&#62; &#60;li id="li4" value="4"&#62;Four&#60;/li&#62; &#60;/ul&#62; It is working OK. $(function() { alert($('#li2').attr('value')); }); But if you have (string as values instead of integers): &#60;ul&#62; &#60;li id="li1" value="One"&#62;One&#60;/li&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>We experienced a problem using <strong>attr(&#8220;value&#8221;)</strong> JQuery function when selecting values that are not integers.</p>
<h3><strong>So if you have:</strong></h3>
<pre class="html">  &lt;ul&gt;
    &lt;li id="li1" value="1"&gt;One&lt;/li&gt;
    &lt;li id="li2" value="2"&gt;Two&lt;/li&gt;
    &lt;li id="li3" value="3"&gt;Three&lt;/li&gt;
    &lt;li id="li4" value="4"&gt;Four&lt;/li&gt;
  &lt;/ul&gt;
</pre>
<h3><strong>It is working OK.</strong></h3>
<pre class="jscript">  $(function() {
    alert($('#li2').attr('value'));
  });
</pre>
<h3><strong>But if you have (string as values instead of integers):</strong></h3>
<pre class="html">  &lt;ul&gt;
    &lt;li id="li1" value="One"&gt;One&lt;/li&gt;
    &lt;li id="li2" value="Two"&gt;Two&lt;/li&gt;
    &lt;li id="li3" value="Three"&gt;Three&lt;/li&gt;
    &lt;li id="li4" value="Four"&gt;Four&lt;/li&gt;
  &lt;/ul&gt;
</pre>
<h3><strong>This is not working.</strong></h3>
<pre class="jscript">  $(function() {
    alert($('#li2').attr('value'));
  });
</pre>
<h3><strong>Solution (rename value attribute to something else):</strong></h3>
<pre class="html">  &lt;ul&gt;
    &lt;li id="li1" tag="One"&gt;One&lt;/li&gt;
    &lt;li id="li2" tag="Two"&gt;Two&lt;/li&gt;
    &lt;li id="li3" tag="Three"&gt;Three&lt;/li&gt;
    &lt;li id="li4" tag="Four"&gt;Four&lt;/li&gt;
  &lt;/ul&gt;
</pre>
<h3><strong>This is now OK.</strong></h3>
<pre class="jscript">  $(function() {
    alert($('#li2').attr('tag'));
  });
</pre>
<h3><strong>Conclusion:</strong></h3>
<p>Do not use reserved attributes as your custom attributes (where HTML element does not support them).</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/03/jquery-problem-with-attr-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create your own JQuery function</title>
		<link>http://tech.avivo.si/2011/02/create-your-own-jquery-function/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=create-your-own-jquery-function</link>
		<comments>http://tech.avivo.si/2011/02/create-your-own-jquery-function/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 18:05:21 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[HTML, Javascript and CSS]]></category>
		<category><![CDATA[custom jquery function]]></category>
		<category><![CDATA[extend jquery function]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[user defined jquery fucntions]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1217</guid>
		<description><![CDATA[As written in this article &#8230; $.fn.myFunction = function() { return $(this).addClass('changed'); } And now, use it like this: $('.changePlease').myFunction();]]></description>
			<content:encoded><![CDATA[<p>As written in <a href="http://jquery-howto.blogspot.com/2008/12/how-to-add-your-own-custom-functions-to.html" target="_blank">this article</a> &#8230;</p>
<pre class="jscript">
$.fn.myFunction = function()
{
  return $(this).addClass('changed');
}
</pre>
</p>
<p>And now, use it like this:</p>
<pre class="jscript">
$('.changePlease').myFunction();
</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/02/create-your-own-jquery-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to select first and last child / element with JQuery</title>
		<link>http://tech.avivo.si/2011/02/how-to-select-first-and-last-child-element-with-jquery/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-select-first-and-last-child-element-with-jquery</link>
		<comments>http://tech.avivo.si/2011/02/how-to-select-first-and-last-child-element-with-jquery/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 23:03:52 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[HTML, Javascript and CSS]]></category>
		<category><![CDATA[get first and last child with jquery]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[select first and last child]]></category>
		<category><![CDATA[select first and last item in list with jquery]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1212</guid>
		<description><![CDATA[&#60;ul class="menu"&#62; &#60;li class="page_item"&#62;First Item&#60;/li&#62; &#60;li class="page_item"&#62;Second Item&#60;/li&#62; &#60;li class="page_item"&#62;Third Item&#60;/li&#62; &#60;li class="page_item"&#62;Last Item&#60;/li&#62; &#60;/ul&#62; &#60;script type="text/javascript"&#62; $(function() { //Add css classes to first and last item in the html list $('ul.menu li:first-child').addClass('first_item'); $('ul.menu li:last-child').addClass('last_item'); }); &#60;/script&#62;]]></description>
			<content:encoded><![CDATA[<pre class="jscript">
&lt;ul class="menu"&gt;
  &lt;li class="page_item"&gt;First Item&lt;/li&gt;
  &lt;li class="page_item"&gt;Second Item&lt;/li&gt;
  &lt;li class="page_item"&gt;Third Item&lt;/li&gt;
  &lt;li class="page_item"&gt;Last Item&lt;/li&gt;
&lt;/ul&gt;

&lt;script type="text/javascript"&gt;
  $(function()
  {
    //Add css classes to first and last item in the html list
    $('ul.menu li:first-child').addClass('first_item');
    $('ul.menu li:last-child').addClass('last_item');
  });
&lt;/script&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/02/how-to-select-first-and-last-child-element-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preloading images with JavaScript (JQuery) and JQuery cool animations and effects</title>
		<link>http://tech.avivo.si/2011/01/preloading-images-with-javascript-jquery-and-jquery-animations-and-effect/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=preloading-images-with-javascript-jquery-and-jquery-animations-and-effect</link>
		<comments>http://tech.avivo.si/2011/01/preloading-images-with-javascript-jquery-and-jquery-animations-and-effect/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 16:29:02 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[HTML, Javascript and CSS]]></category>
		<category><![CDATA[animations]]></category>
		<category><![CDATA[client side]]></category>
		<category><![CDATA[effect]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery animations]]></category>
		<category><![CDATA[jquery effects]]></category>
		<category><![CDATA[preloading images with javascript]]></category>
		<category><![CDATA[preloading images with jquery]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1132</guid>
		<description><![CDATA[Model 1: &#60;img src="images/blank.gif" onload="replaceImage(this, 'your-image-url')" width="75" height="75" /&#62; Use function to replaceImage: function replaceImage(img, replacementImage) { img.onload = null; img.src = replacementImage; } blank.gif is an 1px x 1px pixel transparent image. Basically, the idea is that this blank image is loaded and expanded to 75&#215;75 (to preserve layout). That almost immediately fires the [...]]]></description>
			<content:encoded><![CDATA[<h3><strong>Model 1:</strong></h3>
<pre class="html">&lt;img src="images/blank.gif" onload="replaceImage(this, 'your-image-url')" width="75" height="75" /&gt;
</pre>
<p>Use function to replaceImage:</p>
<pre class="javascript">function replaceImage(img, replacementImage)
{
  img.onload = null;
  img.src = replacementImage;
}
</pre>
<p>blank.gif is an 1px x 1px  pixel transparent image. Basically, the idea is that this blank image is loaded and expanded to 75&#215;75 (to preserve layout). That almost immediately fires the onload handler, which changes the image&#8217;s source to the desired image.</p>
<h3><strong>Model 2:</strong></h3>
<pre class="javascript">var img = new Image();
img.onError = function(){
  //error handling here
}
img.onLoad = function(){
  //success
containerForImg.removeClass('loading-image').append($(img));
}
img.onAbort = function(){
  //user clicked stop
}
img.src = "http://example.com"   //loading begins NOW!
</pre>
<h3><strong>References:</strong></h3>
<p><a href="http://goo.by/wE3TFa" target="_blank">http://goo.by/wE3TFa</a><br />
<a href="http://goo.by/w7AjZN" target="_blank">http://goo.by/w7AjZN</a><br />
<a href="http://goo.by/w0CsbA" target="_blank">http://goo.by/w0CsbA</a></p>
<h3><strong>Background image animations:</strong></h3>
<pre class="css">$('#nav a')
.css( {backgroundPosition: "0 0"} )
.mouseover(function(){
$(this).stop().animate(
{backgroundPosition:"(0 -250px)"},
{duration:500})
})
.mouseout(function(){
$(this).stop().animate(
{backgroundPosition:"(0 0)"},
{duration:500})
})
</pre>
<h3><strong>Background transitions:</strong></h3>
<p><a href="http://goo.by/wIJ6iD" target="_blank">http://goo.by/wIJ6iD</a></p>
<h3><strong>Cool JQuery Animated robot:</strong></h3>
<p>TUTORIAL: <a href="http://goo.by/w4znKB" target="_blank">http://goo.by/w4znKB</a><br />
DEMO: <a href="http://goo.by/wmSMKs" target="_blank">http://goo.by/wmSMKs</a></p>
<h3><strong>Nice login page:</strong></h3>
<p>TUTORIAL: <a href="http://goo.by/wBrnQi" target="_blank">http://goo.by/wBrnQi</a><br />
DEMO: <a href="http://goo.by/wdgmT1" target="_blank">http://goo.by/wdgmT1</a></p>
<h3><strong>Loading content:</strong></h3>
<p>TUTORIAL: <a href="http://goo.by/wn53Y0" target="_blank">http://goo.by/wn53Y0</a><br />
DEMO: <a href="http://goo.by/wTGKDx" target="_blank">http://goo.by/wTGKDx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/01/preloading-images-with-javascript-jquery-and-jquery-animations-and-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use Ajax and JQuery to load dependable combobox values onchange event</title>
		<link>http://tech.avivo.si/2010/10/use-ajax-and-jquery-to-load-dependable-combobox-values-onchange-event/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=use-ajax-and-jquery-to-load-dependable-combobox-values-onchange-event</link>
		<comments>http://tech.avivo.si/2010/10/use-ajax-and-jquery-to-load-dependable-combobox-values-onchange-event/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 16:49:35 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[HTML, Javascript and CSS]]></category>
		<category><![CDATA[dependable combobox]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[load childs]]></category>
		<category><![CDATA[onchange event]]></category>
		<category><![CDATA[use ajax and jquery to load combobox]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=653</guid>
		<description><![CDATA[Imagine that you have combobox for countries and you want to load all cities for chosen country in other dependable combobox. This is the way how you can do it. //This occurs when country combobox changes -> filling cities on country change $('select#CountryId').change(function() { url = 'http://www.someurl.com/' + $('select#CountryId').val(); var dataToSend='CityId=' + $('select#CityId').val(); $.ajax( { [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine that you have combobox for countries and you want to load all cities for chosen country in other dependable combobox.<br />
This is the way how you can do it.</p>
<pre class=jscript>
//This occurs when country combobox changes -> filling cities on country change
$('select#CountryId').change(function()
{
	url = 'http://www.someurl.com/' + $('select#CountryId').val();
	var dataToSend='CityId=' + $('select#CityId').val();
	$.ajax(
	{
		type: "POST",
		url: url,
		data: dataToSend,
		async : false,
		cache : false,
		dataType: "json",
		success:function(data)
		{
			var options = '';
			var selectedText = '';
			$.each(data, function(index, val)
			{
				var selectedString = '';
				if (val.Selected == true)
				{
					selectedText = val.Text;
					selectedString = ' selected="selected"';
				}
				options += '
<option value="' + val.Value + '"' + selectedString + '>' + val.Text + '</option>

';
			});
			$('select#CityId').html(options);
		}
	});
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2010/10/use-ajax-and-jquery-to-load-dependable-combobox-values-onchange-event/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prevent link click with JQuery, avoid the javascript:void(0)</title>
		<link>http://tech.avivo.si/2010/03/prevent-link-click-with-jquery-avoid-the-javascriptvoid0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=prevent-link-click-with-jquery-avoid-the-javascriptvoid0</link>
		<comments>http://tech.avivo.si/2010/03/prevent-link-click-with-jquery-avoid-the-javascriptvoid0/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 12:52:19 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[HTML, Javascript and CSS]]></category>
		<category><![CDATA[avoid link click]]></category>
		<category><![CDATA[avoid the void]]></category>
		<category><![CDATA[do not use javascript:void(0)]]></category>
		<category><![CDATA[how to prevent a href click]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[prevent javascript:void(0)]]></category>
		<category><![CDATA[prevent link click using jquery]]></category>
		<category><![CDATA[search engine optimization]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=456</guid>
		<description><![CDATA[It is forbidden to use: &#60;a href="javascript:void(0);"&#62;Some text&#60;/a&#62; Instead of that use JQuery to simulate link and you can put in href attribute whatever you want: &#60;a id="myLink" href="everything-i-want-to-rewrite" title="link title"&#62;Some text&#60;/a&#62; And in JQuery use this: $("#myLink").click(function(e) { // //do something // //Prevent event propagation and click e.preventDefault(); });]]></description>
			<content:encoded><![CDATA[<div style="margin-bottom:30px;">
It is forbidden to use:</p>
<pre class="html">
&lt;a href="javascript:void(0);"&gt;Some text&lt;/a&gt;
</pre>
</div>
<div style="margin-bottom:30px;">
Instead of that use JQuery to simulate link and you can put in href attribute whatever you want:</p>
<pre class="html">
&lt;a id="myLink" href="everything-i-want-to-rewrite" title="link title"&gt;Some text&lt;/a&gt;
</pre>
</div>
<p>And in JQuery use this:</p>
<pre class="javascript">
$("#myLink").click(function(e) {
  //
  //do something
  //

  //Prevent event propagation and click
  e.preventDefault();
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2010/03/prevent-link-click-with-jquery-avoid-the-javascriptvoid0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to center div using JQuery</title>
		<link>http://tech.avivo.si/2010/01/how-to-center-div-using-jquery/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-center-div-using-jquery</link>
		<comments>http://tech.avivo.si/2010/01/how-to-center-div-using-jquery/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 17:55:53 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[HTML, Javascript and CSS]]></category>
		<category><![CDATA[align center]]></category>
		<category><![CDATA[calculate div position]]></category>
		<category><![CDATA[calculate element position]]></category>
		<category><![CDATA[center div  inside another div]]></category>
		<category><![CDATA[center div using javascript]]></category>
		<category><![CDATA[center element in html]]></category>
		<category><![CDATA[find left offset]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[offset]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=299</guid>
		<description><![CDATA[How can you center div or how can you center div inside another div? This is a common problem. For example, you have a paging with different number of pages and you need to center whole paging div inside parent div container. JQuery is helpful there. Look first at the picture (we want to center [...]]]></description>
			<content:encoded><![CDATA[<p>How can you center <strong>div </strong>or how can you center div inside another <strong>div</strong>?</p>
<p>This is a common problem.</p>
<p>For example, you have a paging with different number of pages and you need to center whole paging <strong>div </strong>inside parent div container.</p>
<p><strong>JQuery </strong>is helpful there.</p>
<p>Look first at the picture (we want to center this paging control inside parent <strong>div </strong>control)</p>
<div id="attachment_306" class="wp-caption alignnone" style="width: 694px"><a href="http://tech.avivo.si/wp-content/uploads/2010/01/paging.jpg"><img class="size-full wp-image-306" title="Center paging control" src="http://tech.avivo.si/wp-content/uploads/2010/01/paging.jpg" alt="Center paging control" width="684" height="72" /></a><p class="wp-caption-text">Center paging control</p></div>
<div style="margin-top:30px;">If you have paging <strong>div</strong>:</div>
<pre class="html">&lt;div id="paging" class="jPaginate" style="padding-left: 67px; left: 0px;"&gt;
  &lt;div class="jPag-control-back"&gt;&lt;a class="jPag-first" style="border: 1px solid #8496ad;
    color: #000000; background-color: #ffffff;"&gt;First&lt;/a&gt;
    &lt;span class="jPag-sprevious"&gt;«&lt;/span&gt;&lt;/div&gt;
  &lt;div style="overflow: hidden; width: 410px;"&gt;
    &lt;ul class="jPag-pages"&gt;
      &lt;li&gt;&lt;span class="jPag-current" style="border: 1px solid #cccccc; color: #ffffff;
        background-color: #0075ff;"&gt;1&lt;/span&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a style="border: 1px solid #8496ad; color: #000000;
        background-color: #ffffff;"&gt;2&lt;/a&gt;&lt;/li&gt;
      &lt;!--...more pages...--&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div class="jPag-control-front" style="left: 481px;"&gt;
     &lt;span class="jPag-snext"&gt;»&lt;/span&gt;&lt;a class="jPag-last"
     style="border: 1px solid #8496ad; color: #000000;
     background-color: #ffffff;"&gt;Last&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<div style="margin-top:30px;">You can use JQuery syntax:</div>
<pre class="js">$("#paging").css('left',($("#paging").width() -
  ($(".jPag-control-front").position().left +
   $(".jPag-control-front").width())) / 2);</pre>
<div style="margin-top:30px;">What does this JQuery command do?</div>
<ul>
<li>$(&#8220;#paging&#8221;) &#8211; finds <strong>div </strong>with<strong> id=&#8221;paging&#8221;</strong></li>
<li>$(&#8220;#paging&#8221;).css(&#8216;left&#8217;, 50); &#8211; move left <strong>&#8220;paging&#8221; </strong><strong>div </strong>for 50px</li>
<li>$(&#8220;.jPag-control-front&#8221;).position().left &#8211; finds left distance for <strong>div </strong>element that has css <strong>class=&#8221;jPag-control-front&#8221; </strong>from the beginning of <strong>&#8220;paging&#8221; div </strong></li>
<li>So, you get the left distance of <strong>Last element </strong>(<strong>div </strong>that has css <strong>class=&#8221;jPag-control-front&#8221; </strong>) and you add the width of <strong>Last </strong>element to this left offset and then you substract this sum from parent <strong>div </strong>width and, at the end, you divide all this by two to get the blank space you need to move you paging <strong>div </strong>from the left.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2010/01/how-to-center-div-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

