<?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>jQuery &#8211; Blackbams Blog</title>
	<atom:link href="https://blog.blackbam.at/tag/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.blackbam.at</link>
	<description>development - digital arts - internet</description>
	<lastBuildDate>Sat, 15 Feb 2014 02:35:38 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.1</generator>
	<item>
		<title>How to scale images responsive with jQuery</title>
		<link>https://blog.blackbam.at/2014/02/15/how-to-scale-images-responsive-with-jquery/</link>
					<comments>https://blog.blackbam.at/2014/02/15/how-to-scale-images-responsive-with-jquery/#respond</comments>
		
		<dc:creator><![CDATA[Blackbam]]></dc:creator>
		<pubDate>Sat, 15 Feb 2014 02:35:38 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">https://blog.blackbam.at/?p=2165</guid>

					<description><![CDATA[When coding responsive Web-Designs we usually have images in the content and in various containers with varying dimensions. In these containers, images should never be bigger than the HTML-container itself. In order to solve this problem I have developed this little script which may be helpful for some of you visitors, too. It is just [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>When coding responsive Web-Designs we usually have images in the content and in various containers with varying dimensions. In these containers, images should never be bigger than the HTML-container itself. In order to solve this problem I have developed this little script which may be helpful for some of you visitors, too. It is just required to set a jQuery selector for the container itself (to get the maximum width) and one to select all the images affected.</p>
<pre lang="javascript">

function scale_content_images() {

    $('#my_container img').each(function() {

            var the_image = this;
            var maxAvailableWidth = $('#my_container').width()-20; // Max width for the image
            var ratio = 0;  // Used for aspect ratio
            var width = $(this).width();    // Current image width
            var height = $(this).height();  // Current image height
            var orig_width = parseInt($(this).attr("width")); // the intended width of the image
            var orig_height = parseInt($(this).attr("height")); // the intended height of the image

            // if intended width/height not available, get original image dimensions and set these
            if(isNaN(orig_width)||isNaN(orig_height)) {
                var image = new Image();
                image.src = $(the_image).attr("src");
                orig_width = image.naturalWidth;
                orig_height= image.naturalHeight;
            }

            // Check if the current width is larger than the max
            if(orig_width>maxAvailableWidth) {
                ratio = maxAvailableWidth / width;   // get ratio for scaling image
                $(this).css("width", maxAvailableWidth); // Set new width
                $(this).css("height", height * ratio);  // Scale height based on ratio
                height = height * ratio;    // Reset height to match scaled image
                width = width * ratio;    // Reset width to match scaled image
            } else {
                $(this).css("width",orig_width);
                $(this).css("height",orig_height);
            }
        });
}

$(document).ready(function() {
      scale_content_images();
});

$(document).resize(function() {
      scale_content_images();
});

</pre>
<p><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fblog.blackbam.at%2F2014%2F02%2F15%2Fhow-to-scale-images-responsive-with-jquery%2F&#038;title=How%20to%20scale%20images%20responsive%20with%20jQuery" data-a2a-url="https://blog.blackbam.at/2014/02/15/how-to-scale-images-responsive-with-jquery/" data-a2a-title="How to scale images responsive with jQuery"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://blog.blackbam.at/2014/02/15/how-to-scale-images-responsive-with-jquery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to add social media buttons to jQuery Colorbox</title>
		<link>https://blog.blackbam.at/2013/07/02/how-to-add-social-media-buttons-to-jquery-colorbox/</link>
					<comments>https://blog.blackbam.at/2013/07/02/how-to-add-social-media-buttons-to-jquery-colorbox/#comments</comments>
		
		<dc:creator><![CDATA[Blackbam]]></dc:creator>
		<pubDate>Tue, 02 Jul 2013 13:02:03 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Colorbox]]></category>
		<category><![CDATA[Social Media]]></category>
		<guid isPermaLink="false">https://blog.blackbam.at/?p=2059</guid>

					<description><![CDATA[Recently a client wanted to display social media buttons like facebook, twitter and google plus at the bottom of each image in jQuery Colorbox. As it is bad practice to change the source code of a Plugin, the following code worked well for this job. &#160; Note: This client wanted the full URL to be [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Recently a client wanted to display social media buttons like facebook, twitter and google plus at the bottom of each image in jQuery Colorbox. As it is bad practice to change the source code of a Plugin, the following code worked well for this job.</p>
<p>&nbsp;</p>
<p>Note: This client wanted the full URL to be liked, not the image itself &#8211; if you want to do so, you should &nbsp;like/recommend the attachemnt URL of the colorbox images, not the URL of the page. I will leave this up to you, to change the code in this way.</p>
<p>&nbsp;</p>
<div class="code_title">Add the following jQuery code to the footer of your page:</div>
<pre lang="javascript">

		jQuery(document).ready(function() { 
			var facebook = '<div class="cb_social_elem cb_fb"><div class="fb-like" data-href="" data-send="false" data-layout="button_count" data-width="160" data-show-faces="true" data-font="arial"></div></div>';
			var twitter = '<div class="cb_social_elem"><a href="https://twitter.com/share" class="twitter-share-button" data-lang="de" data-count="horizontal">Tweet</a></div>';
			var google = '<div class="cb_social_elem"><g:plusone size="medium" annotation="bubble"></g:plusone></div>';
			
		    jQuery("#cboxContent").append('<div id="cboxSocials">'+facebook+twitter+google+'</div><div class="clear"></div>'); 
		});
			
</pre>
<div class="code_title">CSS code</div>
<pre lang="css">
#cboxSocials {
	margin-top:-43px;
}

.cb_social_elem {
	float:left;
	margin-right:20px;
	width:120px;
}

</pre>
<p>&nbsp;</p>
<h3>Social Buttons Developer Links</h3>
<p><a href="https://developers.facebook.com/docs/reference/plugins/like/">Facebook Like</a></p>
<p><a href="https://dev.twitter.com/docs/tweet-button">Twitter</a></p>
<p><a href="https://developers.google.com/+/web/+1button/">Google+</a></p>
<p><a href="http://developer.linkedin.com/retrieving-share-counts-custom-buttons">LinkedIn</a></p>
<p><a href="http://business.pinterest.com/widget-builder/">Pinterest</a></p></p>
<p><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fblog.blackbam.at%2F2013%2F07%2F02%2Fhow-to-add-social-media-buttons-to-jquery-colorbox%2F&#038;title=How%20to%20add%20social%20media%20buttons%20to%20jQuery%20Colorbox" data-a2a-url="https://blog.blackbam.at/2013/07/02/how-to-add-social-media-buttons-to-jquery-colorbox/" data-a2a-title="How to add social media buttons to jQuery Colorbox"><img src="https://static.addtoany.com/buttons/share_save_120_16.png" alt="Share"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://blog.blackbam.at/2013/07/02/how-to-add-social-media-buttons-to-jquery-colorbox/feed/</wfw:commentRss>
			<slash:comments>12</slash:comments>
		
		
			</item>
	</channel>
</rss>
