<?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/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>jQuery Archives - Michael Sunarlim</title>
	<atom:link href="https://sunarlim.com/category/web-development/jquery-web-development/feed/" rel="self" type="application/rss+xml" />
	<link>https://sunarlim.com/category/web-development/jquery-web-development/</link>
	<description>Random blurbs about web development, e-commerce and technology</description>
	<lastBuildDate>Fri, 19 Mar 2021 20:03:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.5</generator>

<image>
	<url>https://i0.wp.com/sunarlim.com/wp-content/uploads/2016/07/cropped-MS_Square_512x512.png?fit=32%2C32&#038;ssl=1</url>
	<title>jQuery Archives - Michael Sunarlim</title>
	<link>https://sunarlim.com/category/web-development/jquery-web-development/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">30613895</site>	<item>
		<title>MailChimp Subscribe Form with PHP, jQuery and AJAX (API 3.0)</title>
		<link>https://sunarlim.com/2017/01/mailchimp-subscribe-form-php-jquery-api3/</link>
					<comments>https://sunarlim.com/2017/01/mailchimp-subscribe-form-php-jquery-api3/#comments</comments>
		
		<dc:creator><![CDATA[Michael]]></dc:creator>
		<pubDate>Mon, 09 Jan 2017 06:48:18 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[mailchimp]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">https://sunarlim.com/?p=2591</guid>

					<description><![CDATA[<p>By popular demand, I updated my code and posted it as new GitHub repository that utilizes newer MailChimp API 3.0. Please read the tutorial below to create AJAX based MailChimp subscribe form on your PHP website with a little jQuery knowledge. Original post using (older and no longer supported) MailChimp API 1.0 can be found here. What... <span class="more"><a class="more-link" href="https://sunarlim.com/2017/01/mailchimp-subscribe-form-php-jquery-api3/">Continue reading <span class="meta-nav">&#8594;</span></a></span></p>
<p>The post <a href="https://sunarlim.com/2017/01/mailchimp-subscribe-form-php-jquery-api3/">MailChimp Subscribe Form with PHP, jQuery and AJAX (API 3.0)</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>By popular demand, I updated my code and posted it as <a href="https://github.com/sunarlim/mailchimp-subscribe-api-v3" target="_blank" rel="noopener">new GitHub repository</a> that utilizes newer MailChimp API 3.0. Please read the tutorial below to create AJAX based MailChimp subscribe form on your PHP website with a little jQuery knowledge.</p>
<p>Original post using (older and no longer supported) MailChimp API 1.0 can be found <a href="https://sunarlim.com/2014/04/mailchimp-sign-form-php-jquery-ajax/">here</a>.</p>
<h3>What this code does</h3>
<ul>
<li>Validate field contents</li>
<li>Pass the form submission to MailChimp and add the record to your list</li>
<li>Basic fallback method for very, very old browser or does not have JavaScript activated</li>
<li>Very customizable and easily expandable, depending on your requirements</li>
<li>jQuery and jQuery Validation plugin called from CDNJS to keep number of files to maintain at minimal</li>
</ul>
<p><span id="more-2591"></span></p>
<h3>Tools/Credits</h3>
<ol>
<li><a title="jQuery" href="http://jquery.com/" target="_blank" rel="noopener">jQuery</a></li>
<li><a title="jQuery Validation" href="http://jqueryvalidation.org/" target="_blank" rel="noopener">jQuery Validation Plugin</a></li>
<li><a title="MailChimp API Wrappers" href="https://github.com/drewm/mailchimp-api" target="_blank" rel="noopener">MailChimp API v3 PHP Wrapper</a></li>
</ol>
<h3>MailChimp API Key and List ID</h3>
<p>Below we start, we need to generate public API key from your MailChimp account and also identify your list ID. If you are not sure how to retrieve those, follow these links from MailChimp Knowledge Base to <a title="MailChimp - Finding or generating your API key" href="http://kb.mailchimp.com/accounts/management/about-api-keys#Finding-or-generating-your-API-key" target="_blank" rel="noopener">retrieve your account&#8217;s API key</a> and <a title="MailChimp - Find Your List ID" href="http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id" target="_blank" rel="noopener">find your list ID</a>.</p>
<h4>The Form Page (index.php)</h4>
<p>jQuery will handle the AJAX using <span class="lang:js decode:true crayon-inline">$.post</span>  method and jQuery Validation plugin will validate the field values including email address format.</p>
<p>For this example, I am including first name and last name as part of the form fields. Feel free to make adjustments as required. Although keep in mind after changing the form fields, you may also need to adjust the <span class="lang:default decode:true crayon-inline">subscribe.php</span>  file too.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-linenumbers="false">&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;MailChimp (API v3) Sign-Up Form&lt;/title&gt;
  &lt;script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.16.0/jquery.validate.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    $(document).ready(function() {
      // jQuery Validation
      $("#signup").validate({
        // if valid, post data via AJAX
        submitHandler: function(form) {
          $.post("subscribe.php", { fname: $("#fname").val(), lname: $("#lname").val(), email: $("#email").val() }, function(data) {
            $('#response').html(data);
          });
        },
        // all fields are required
        rules: {
          fname: {
            required: true
          },
          lname: {
            required: true
          },
          email: {
            required: true,
            email: true
          }
        }
      });
    });
  &lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
  &lt;div id="wrapper"&gt;
    &lt;form id="signup" class="formee" action="subscribe.php" method="post"&gt;
      &lt;fieldset&gt;
        &lt;legend&gt;Sign Up&lt;/legend&gt;
        &lt;div&gt;
          &lt;label for="fname"&gt;First Name *&lt;/label&gt; &lt;input name="fname" id="fname" type="text" /&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;label for="lname"&gt;Last Name *&lt;/label&gt; &lt;input name="lname" id="lname" type="text" /&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;label for="email"&gt;Email Address *&lt;/label&gt; &lt;input name="email" id="email" type="text" /&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;input class="right inputnew" type="submit" title="Send" value="Send" /&gt;
        &lt;/div&gt;
      &lt;/fieldset&gt;
    &lt;/form&gt;
    &lt;div id="response"&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<h4>Form Processor <em>(subscribe.php)</em></h4>
<p>I try to include as much comment as possible to make the code self explanatory.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-linenumbers="false">&lt;?php

  // Put your MailChimp API and List ID hehe
  $api_key = 'ENTER_YOUR_API_KEY_HERE';
  $list_id = 'ENTER_YOUR_LIST_ID_HERE';

  // Let's start by including the MailChimp API wrapper
  include('./inc/MailChimp.php');
  // Then call/use the class
  use \DrewM\MailChimp\MailChimp;
  $MailChimp = new MailChimp($api_key);

  // Submit subscriber data to MailChimp
  // For parameters doc, refer to: http://developer.mailchimp.com/documentation/mailchimp/reference/lists/members/
  // For wrapper's doc, visit: https://github.com/drewm/mailchimp-api
  $result = $MailChimp-&gt;post("lists/$list_id/members", [
              'email_address' =&gt; $_POST["email"],
              'merge_fields'  =&gt; ['FNAME'=&gt;$_POST["fname"], 'LNAME'=&gt;$_POST["lname"]],
              'status'        =&gt; 'subscribed',
            ]);

  if ($MailChimp-&gt;success()) {
    // Success message
    echo "&lt;h4&gt;Thank you, you have been added to our mailing list.&lt;/h4&gt;";
  } else {
    // Display error
    echo $MailChimp-&gt;getLastError();
    // Alternatively you can use a generic error message like:
    // echo "&lt;h4&gt;Please try again.&lt;/h4&gt;";
  }
?&gt;</pre>
<h3>Download</h3>
<p><a href="https://github.com/sunarlim/mailchimp-subscribe-api-v3/archive/master.zip">Click here to download</a> the basic files to create MailChimp subscribe form on your website. Alternatively, you can also <a href="https://github.com/sunarlim/mailchimp-subscribe-api-v3" target="_blank" rel="noopener">visit the GitHub repository</a>.</p>
<h3>Coming Soon Templates</h3>
<p>The MailChimp subscribe form example only includes basic HTML page. If you are thinking of using it for your upcoming site, and you have limited resources to create the page design, check out my list of <a title="5 Clean and Free Coming Soon Page Templates with Email Subscription Form" href="https://sunarlim.com/2014/05/5-clean-and-free-coming-soon-page-templates/">5 Clean and Free Coming Soon Page Templates</a> and <a title="ThemeForest &gt; Site Templates &gt; Specialty Pages &gt; Under Construction" href="http://themeforest.net/category/site-templates/specialty-pages/under-construction?ref=mayksyu" target="_blank" rel="noopener">Coming Soon &amp; Under Construction Templates on ThemeForest</a>.</p>
<p>The post <a href="https://sunarlim.com/2017/01/mailchimp-subscribe-form-php-jquery-api3/">MailChimp Subscribe Form with PHP, jQuery and AJAX (API 3.0)</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sunarlim.com/2017/01/mailchimp-subscribe-form-php-jquery-api3/feed/</wfw:commentRss>
			<slash:comments>38</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2591</post-id>	</item>
		<item>
		<title>Front End Frameworks Based on Google&#8217;s Material Design</title>
		<link>https://sunarlim.com/2014/11/front-end-frameworks-based-on-material-design/</link>
					<comments>https://sunarlim.com/2014/11/front-end-frameworks-based-on-material-design/#respond</comments>
		
		<dc:creator><![CDATA[Michael]]></dc:creator>
		<pubDate>Tue, 11 Nov 2014 10:18:33 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">https://sunarlim.com/?p=1212</guid>

					<description><![CDATA[<p>If you love Material Design, there is no reason why you should not try to use it as the DNA of your next project. Luckily a bunch of talented people took very little time to make things easier for their fellow designers and developers to be able to take make use the framework to their site's design.</p>
<p>The post <a href="https://sunarlim.com/2014/11/front-end-frameworks-based-on-material-design/">Front End Frameworks Based on Google&#8217;s Material Design</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In recent years we&#8217;ve seen Google has taken design very seriously. I personally think their competition with Apple in the tablet/smartphone war (Android vs iOS) forced them to take their design/visual up a few levels.</p>
<p>Google is not only polishing the interface on their mobile OS platform, but streamlining most of their wonderful and indispensable web applications with a unified look and style. <a href="http://www.google.com/design/spec/material-design/introduction.html" target="_blank">Material Design</a> is the latest design/visual language developed by Google and announced at the Google I/O conference in June 2014. As with latest UI design philosophy, Google went with flat look and focused on the details. While the direction is open for personal&#8217;s opinions, in overall I think Google has done a remarkable job.</p>
<p>If you love Material Design, there is no reason why you should not try to use it as the DNA of your next project. Luckily a bunch of talented people took very little time to make things easier for their fellow designers and developers to be able to take make use the framework to their site&#8217;s design.</p>
<h3><a href="http://dogfalo.github.io/materialize/" target="_blank">Materialize</a></h3>
<p><a href="http://dogfalo.github.io/materialize/" target="_blank"><img fetchpriority="high" decoding="async" src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Materialize_-_Documentation.png?resize=740%2C296&#038;ssl=1" alt="Materialize" width="740" height="296" class="alignnone size-full wp-image-1219" srcset="https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Materialize_-_Documentation.png?w=1200&amp;ssl=1 1200w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Materialize_-_Documentation.png?resize=300%2C120&amp;ssl=1 300w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Materialize_-_Documentation.png?resize=1024%2C409&amp;ssl=1 1024w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Materialize_-_Documentation.png?resize=150%2C60&amp;ssl=1 150w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Materialize_-_Documentation.png?resize=400%2C160&amp;ssl=1 400w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Materialize_-_Documentation.png?resize=800%2C320&amp;ssl=1 800w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Materialize_-_Documentation.png?resize=200%2C80&amp;ssl=1 200w" sizes="(max-width: 740px) 100vw, 740px" data-recalc-dims="1" /></a></p>
<p>This one goes on the top of my list because it feels like most polished and actively developed. The framework homepage shows a clear example how you can create nice look on your websites using their components.</p>
<h3><a href="https://fezvrasta.github.io/bootstrap-material-design/" target="_blank">Bootstrap Material</a></h3>
<p><a href="https://fezvrasta.github.io/bootstrap-material-design/" target="_blank"><img decoding="async" src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Bootstrap_Material.png?resize=740%2C296&#038;ssl=1" alt="Material Design for Bootstrap" width="740" height="296" class="alignnone size-full wp-image-1218" data-recalc-dims="1" /></a></p>
<p>If you are already in love with <a href="http://getbootstrap.com/" target="_blank">Bootstrap</a> and do not want to fool around with another framework, there is a solution for that too through this project by applying Material Design as a Bootstrap theme. Note that as the time of writing, this theme is not ready for production.</p>
<h3><a href="http://material-ui.com/" target="_blank">Material UI</a></h3>
<p><a href="http://material-ui.com/" target="_blank"><img decoding="async" src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Material_UI.png?resize=740%2C272&#038;ssl=1" alt="Material UI" width="740" height="272" class="alignnone size-full wp-image-1220" srcset="https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Material_UI.png?w=1200&amp;ssl=1 1200w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Material_UI.png?resize=300%2C110&amp;ssl=1 300w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Material_UI.png?resize=1024%2C376&amp;ssl=1 1024w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Material_UI.png?resize=150%2C55&amp;ssl=1 150w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Material_UI.png?resize=400%2C147&amp;ssl=1 400w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Material_UI.png?resize=800%2C294&amp;ssl=1 800w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2014/11/Optimize_Material_UI.png?resize=200%2C73&amp;ssl=1 200w" sizes="(max-width: 740px) 100vw, 740px" data-recalc-dims="1" /></a></p>
<p>Last but not least, if you use <a href="http://facebook.github.io/react/" target="_blank">React</a> for your JavaScript library, this framework is definitely for you.</p>
<hr />
<p>There you go. Hopefully the list is useful for you. If you know other front-end frameworks that are based on Material Design, please share them by replying to this post. I would love to check and possibly add them here.</p>
<p>The post <a href="https://sunarlim.com/2014/11/front-end-frameworks-based-on-material-design/">Front End Frameworks Based on Google&#8217;s Material Design</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sunarlim.com/2014/11/front-end-frameworks-based-on-material-design/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1212</post-id>	</item>
		<item>
		<title>MailChimp Subscribe Form with PHP, jQuery and AJAX</title>
		<link>https://sunarlim.com/2014/04/mailchimp-sign-form-php-jquery-ajax/</link>
					<comments>https://sunarlim.com/2014/04/mailchimp-sign-form-php-jquery-ajax/#comments</comments>
		
		<dc:creator><![CDATA[Michael]]></dc:creator>
		<pubDate>Mon, 28 Apr 2014 10:18:26 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[mailchimp]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">https://sunarlim.com/?p=1008</guid>

					<description><![CDATA[<p>I am pretty sure I have mentioned somewhere in this blog or tweets of how I love MailChimp or and would recommend it for any business wanting to untap their email marketing potential. You can start with zero investment and only start paying when you are completely confident it is very worthy. MailChimp provides a... <span class="more"><a class="more-link" href="https://sunarlim.com/2014/04/mailchimp-sign-form-php-jquery-ajax/">Continue reading <span class="meta-nav">&#8594;</span></a></span></p>
<p>The post <a href="https://sunarlim.com/2014/04/mailchimp-sign-form-php-jquery-ajax/">MailChimp Subscribe Form with PHP, jQuery and AJAX</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I am pretty sure I have mentioned somewhere in this blog or tweets of how I love <strong><a title="MailChimp" href="http://mailchimp.com" target="_blank" rel="noopener">MailChimp</a></strong> or and would recommend it for any business wanting to untap their email marketing potential. You can start with zero investment and only start paying when you are completely confident it is very worthy.</p>
<p>MailChimp provides a good tool to generate your custom sign up form which will serve most requirements well. Some customers however, want a fully custom form or integrate it with existing template they already own. Today I am going to share a quick tutorial in how to integrate HTML form with MailChimp API using PHP and jQuery.</p>
<h3>MailChimp Subscribe Form Features</h3>
<p>What will it do?</p>
<ul>
<li>Validate field contents</li>
<li>Pass the form submission to MailChimp and add the record to your list</li>
<li>Basic fallback method for very, very old browser that does not have JavaScript activated</li>
<li>Five minutes setup</li>
</ul>
<p><span id="more-1008"></span></p>
<h3>Tools/Credits</h3>
<ol>
<li><a title="jQuery" href="http://jquery.com/" target="_blank" rel="noopener">jQuery</a></li>
<li><a title="jQuery Validation" href="http://jqueryvalidation.org/" target="_blank" rel="noopener">jQuery Validation Plugin</a></li>
<li><a title="MailChimp API Wrappers" href="http://apidocs.mailchimp.com/api/downloads/#php" target="_blank" rel="noopener">MailChimp PHP API Class</a></li>
</ol>
<h3>The Form Page <em>(index.php)</em></h3>
<p>jQuery will handle the AJAX using <code>$.post</code> method and jQuery Validation plugin will validate the field values including email address format.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="html" data-enlighter-linenumbers="false">&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;MailChimp Sign-Up Form&lt;/title&gt;
  &lt;script type="text/javascript" src="js/jquery-1.11.0.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/jquery.validate.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
    $(document).ready(function() {
      // jQuery Validation
      $("#signup").validate({
        // if valid, post data via AJAX
        submitHandler: function(form) {
          $.post("subscribe.php", { fname: $("#fname").val(), lname: $("#lname").val(), email: $("#email").val() }, function(data) {
            $('#response').html(data);
          });
        },
        // all fields are required
        rules: {
          fname: {
            required: true
          },
          lname: {
            required: true
          },
          email: {
            required: true,
            email: true
          }
        }
      });
    });
  &lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
  &lt;div id="wrapper"&gt;
    &lt;form id="signup" class="formee" action="subscribe.php" method="post"&gt;
      &lt;fieldset&gt;
        &lt;legend&gt;Sign Up&lt;/legend&gt;
        &lt;div&gt;
          &lt;label for="fname"&gt;First Name *&lt;/label&gt; &lt;input name="fname" id="fname" type="text" /&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;label for="lname"&gt;Last Name *&lt;/label&gt; &lt;input name="lname" id="lname" type="text" /&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;label for="email"&gt;Email Address *&lt;/label&gt; &lt;input name="email" id="email" type="text" /&gt;
        &lt;/div&gt;
        &lt;div&gt;
          &lt;input class="right inputnew" type="submit" title="Send" value="Send" /&gt;
        &lt;/div&gt;
      &lt;/fieldset&gt;
    &lt;/form&gt;
    &lt;div id="response"&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<h3>Form Processor <em>(subscribe.php)</em></h3>
<p>Our form will connect to MailChimp with the help of <code>MCAPI.class.php</code>. Please make sure you have generated the API key of your account and copied your list ID. MailChimp&#8217;s excellent knowledge base provides the instructions in <a title="MailChimp - Finding or generating your API key" href="http://kb.mailchimp.com/accounts/management/about-api-keys#Finding-or-generating-your-API-key" target="_blank" rel="noopener">how to retrieve your account&#8217;s API key</a> and <a title="MailChimp - Find Your List ID" href="http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id" target="_blank" rel="noopener">find your list ID</a>.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="php" data-enlighter-linenumbers="false">&lt;?php
  require_once 'inc/MCAPI.class.php';
  $api = new MCAPI('ENTER_YOUR_API_KEY_HERE');
  $merge_vars = array('FNAME'=&gt;$_POST["fname"], 'LNAME'=&gt;$_POST["lname"]);

  // Submit subscriber data to MailChimp
  // For parameters doc, refer to: http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php
  $retval = $api-&gt;listSubscribe( 'ENTER_YOUR_LIST_ID_HERE', $_POST["email"], $merge_vars, 'html', false, true );

  if ($api-&gt;errorCode){
    echo "&lt;h4&gt;Please try again.&lt;/h4&gt;";
  } else {
    echo "&lt;h4&gt;Thank you, you have been added to our mailing list.&lt;/h4&gt;";
  }
?&gt;</pre>
<p>That&#8217;s it! You can now check on your web server with a few tests and see if they are captured in your MailChimp list.</p>
<h3>Download</h3>
<p>Sample files and structure of this tutorial can be <a title="Tutorial Sample Files" href="https://github.com/sunarlim/mailchimp-subscribe/archive/master.zip">downloaded here</a>. Please share this post if you find it useful using social media buttons below.</p>
<h3>Coming Soon Templates</h3>
<p>My files only include a basic HTML page. If you are thinking of using it for your upcoming site, and you have limited resources to create the page design, check out my list of <a title="5 Clean and Free Coming Soon Page Templates with Email Subscription Form" href="https://sunarlim.com/2014/05/5-clean-and-free-coming-soon-page-templates/">5 Clean and Free Coming Soon Page Templates</a> and <a title="ThemeForest &gt; Site Templates &gt; Specialty Pages &gt; Under Construction" href="http://themeforest.net/category/site-templates/specialty-pages/under-construction?ref=mayksyu" target="_blank" rel="noopener">Coming Soon &amp; Under Construction Templates on ThemeForest</a>.</p>
<hr />
<h2>UPDATE (January 9, 2017)</h2>
<p>I have published updated version of this tutorial to make use of MailChimp&#8217;s newer API 3.0. Please follow the link to read how to create <strong><a href="https://sunarlim.com/2017/01/mailchimp-subscribe-form-php-jquery-api3/">MailChimp Subscribe Form with PHP, jQuery and AJAX (API 3.0)</a></strong>.</p>
<p>The post <a href="https://sunarlim.com/2014/04/mailchimp-sign-form-php-jquery-ajax/">MailChimp Subscribe Form with PHP, jQuery and AJAX</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sunarlim.com/2014/04/mailchimp-sign-form-php-jquery-ajax/feed/</wfw:commentRss>
			<slash:comments>127</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1008</post-id>	</item>
		<item>
		<title>Make Vimeo Lightbox Auto-Closes on Finish Using FancyBox</title>
		<link>https://sunarlim.com/2014/04/make-vimeo-lightbox-auto-closes-finish-using-fancybox/</link>
					<comments>https://sunarlim.com/2014/04/make-vimeo-lightbox-auto-closes-finish-using-fancybox/#comments</comments>
		
		<dc:creator><![CDATA[Michael]]></dc:creator>
		<pubDate>Sun, 13 Apr 2014 11:49:15 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[fancybox]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[vimeo]]></category>
		<guid isPermaLink="false">https://sunarlim.com/?p=980</guid>

					<description><![CDATA[<p>FancyBox has been my number one preference when I need to implement a jQuery-based lightbox on any web page I am working on. It is the most customizable and extensible jQuery plugin for this function. Since version 2.0, it also introduced a concept of &#8216;helpers&#8217; to reduce the size of the main JS file and... <span class="more"><a class="more-link" href="https://sunarlim.com/2014/04/make-vimeo-lightbox-auto-closes-finish-using-fancybox/">Continue reading <span class="meta-nav">&#8594;</span></a></span></p>
<p>The post <a href="https://sunarlim.com/2014/04/make-vimeo-lightbox-auto-closes-finish-using-fancybox/">Make Vimeo Lightbox Auto-Closes on Finish Using FancyBox</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>FancyBox has been my number one preference when I need to implement a jQuery-based lightbox on any web page I am working on. It is the most customizable and extensible jQuery plugin for this function.</p>
<p>Since version 2.0, it also introduced a concept of &#8216;helpers&#8217; to reduce the size of the main JS file and also to allow developers to play more with its functionality with less risk of breaking the core functions when they are updated. Below I am going to show a little trick to modify FancyBox&#8217;s media helper to allow Vimeo link to auto-close when the video finishes.</p>
<p><span id="more-980"></span></p>
<h3>Vimeo API</h3>
<p>The first step to achieve this is by understanding <a title="Vimeo Player JavaScript API" href="http://developer.vimeo.com/player/js-api" target="_blank">Vimeo Player JavaScript API</a> and how to enable API calling for the videos. To save your time, there are two items you need to note:</p>
<ol>
<li>You need to turn on the API using <code>api=1</code> code and define the player ID ie. <code>player_id=vimeoplayer</code></li>
<li>Use Froogaloop, a JS mini-library written by Vimeo to communicate with their API. It can be downloaded <a title="Froogaloop on GitHub" href="https://github.com/vimeo/player-api/tree/master/javascript" target="_blank">here</a>.</li>
</ol>
<h3>Modifying Fancybox media helper file</h3>
<p>By default, the media helper file from FancyBox does not define the API and player ID. So we need to make minor change with the <code>helpers/jquery.fancybox-media.js</code>:</p>
<pre class="nums:false nums-toggle:false lang:js decode:true">vimeo : {
    matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/,
    params  : {
        autoplay      : 1,
        hd            : 1,
        show_title    : 1,
        show_byline   : 1,
        show_portrait : 0,
        fullscreen    : 1,
        api           : 1, // enable Vimeo Player API
        player_id     : 'fancybox-vimeo' // define Player ID
    },
    type : 'iframe',
    url  : '//player.vimeo.com/video/$1'
},</pre>
<p>&nbsp;</p>
<p>That&#8217;s it. You may want to save the helper file to another name, like <code>jquery.fancybox-media.custom.js</code></p>
<h3>Putting them together</h3>
<p>First call FancyBox scripts like you usually do, including the customized media helper file and Froogaloop.</p>
<pre class="nums:false nums-toggle:false lang:default decode:true">&lt;link rel="stylesheet" href="/path/to/js/lib/fancybox.v2/jquery.fancybox.css" type="text/css" media="screen" /&gt;
&lt;link rel="stylesheet" href="/path/to/js/lib/fancybox.v2/helpers/jquery.fancybox-buttons.css" type="text/css" media="screen" /&gt;
&lt;script type="text/javascript" src="/path/to/js/lib/jquery.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="/path/to/js/lib/fancybox.v2/jquery.fancybox.pack.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="/path/to/js/lib/fancybox.v2/helpers/jquery.fancybox-media.custom.js?v=1.0.6"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="/path/to/js/lib/jquery.easing.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="/path/to/js/lib/froogaloop.min.js"&gt;&lt;/script&gt;</pre>
<p>Next, let&#8217;s try to call FancyBox that auto-closes when the video has finished playing:</p>
<pre class="nums:false nums-toggle:false lang:xhtml decode:true  ">&lt;script type="text/javascript"&gt;
$(document).ready(function() {
    $("a#pt6vid").fancybox({
        tpl : {
            iframe   : '&lt;iframe id="fancybox-vimeo" name="fancybox-vimeo" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0"&gt;&lt;/iframe&gt;'
        },
        helpers : {
            media : {} // call media helper
        },
        // below is where we call Vimeo Player API
        afterLoad: function(current, previous) {
            var iframe = $('#fancybox-vimeo')[0],
                    player = $f(iframe);
            // When the player is ready, add listeners for pause, finish, and playProgress
            player.addEvent('ready', function() {
                player.addEvent('finish', function(id) {
                    $.fancybox.close();
                });
            });
        }
    });
});
&lt;/script&gt;</pre>
<p>Done.</p>
<p>The post <a href="https://sunarlim.com/2014/04/make-vimeo-lightbox-auto-closes-finish-using-fancybox/">Make Vimeo Lightbox Auto-Closes on Finish Using FancyBox</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sunarlim.com/2014/04/make-vimeo-lightbox-auto-closes-finish-using-fancybox/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">980</post-id>	</item>
		<item>
		<title>jQuery Cycle Pager Style as Dots with CSS</title>
		<link>https://sunarlim.com/2013/05/jquery-cycle-pager-style/</link>
					<comments>https://sunarlim.com/2013/05/jquery-cycle-pager-style/#comments</comments>
		
		<dc:creator><![CDATA[Michael]]></dc:creator>
		<pubDate>Tue, 07 May 2013 02:30:53 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[slideshow]]></category>
		<guid isPermaLink="false">https://sunarlim.com/?p=778</guid>

					<description><![CDATA[<p>jQuery Cycle is a great plugin to create image slides on your website. Out-of-the-box, it is so simple to use but you can explore the options extensively to get the functions and effect that you expected. One of the best feature is the &#8216;pager&#8217; option that will create a pagination of your slideshow. By default,... <span class="more"><a class="more-link" href="https://sunarlim.com/2013/05/jquery-cycle-pager-style/">Continue reading <span class="meta-nav">&#8594;</span></a></span></p>
<p>The post <a href="https://sunarlim.com/2013/05/jquery-cycle-pager-style/">jQuery Cycle Pager Style as Dots with CSS</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="http://jquery.malsup.com/cycle/" target="_blank">jQuery Cycle</a> is a great plugin to create image slides on your website. Out-of-the-box, it is so simple to use but you can explore the options extensively to get the functions and effect that you expected. </p>
<p>One of the best feature is the &#8216;pager&#8217; option that will create a <em>pagination</em> of your slideshow. By default, the function will look up for a container with ID value of &#8216;pager&#8217; and generate this code:<br />
[syntax_prettify linenums=&#8221;&#8221;]<br />
&lt;div id=&quot;pager&quot;&gt;<br />
  &lt;a href=&quot;#&quot; class=&quot;&quot;&gt;1&lt;/a&gt;<br />
  &lt;a href=&quot;#&quot; class=&quot;&quot;&gt;2&lt;/a&gt;<br />
  &lt;a href=&quot;#&quot; class=&quot;activeSlide&quot;&gt;3&lt;/a&gt;<br />
&lt;/div&gt;<br />
[/syntax_prettify]</p>
<p>Without any style, the pager will be shown simply as &#8220;123&#8221; on the front-end. You can of course stylize it any way you like it, I used to fancy the background-image replacement technique, but I want to share the CSS codes that will display it as dots or bullets. Since this is pure CSS, you can easily change the colors or size quickly and easily.<br />
[syntax_prettify linenums=&#8221;&#8221;]<br />
#pager {<br />
  /* you can add positioning properties here if needed */<br />
  width: 75px; /* change as required */<br />
  padding: 0;<br />
  height: 14px;<br />
  z-index: 999;<br />
}</p>
<p>#pager a {<br />
  display: block;<br />
  float: left;<br />
  width: 10px;<br />
  height: 10px;<br />
  text-indent: -999em;<br />
  background: #fff;<br />
  border-radius: 10px; /* must be the same as width and height */<br />
  -moz-border-radius: 10px;<br />
  -webkit-border-radius: 10px;<br />
  box-shadow: 0 0 1px 1px #707173; /* border color */<br />
  margin-right: 10px;<br />
}</p>
<p>#pager a {<br />
  background: #c0c0c0; /* optional: color when hovered */<br />
}</p>
<p>#pager a.activeSlide {<br />
  background: #707173; /* color when active */<br />
}<br />
[/syntax_prettify]</p>
<p>Quick preview of how it will look like:<br />
<img loading="lazy" decoding="async" src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/05/screenshot_199.png?resize=305%2C39&#038;ssl=1" alt="jQuery dots pager preview" width="305" height="39" class="aligncenter size-full wp-image-781" srcset="https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/05/screenshot_199.png?w=305&amp;ssl=1 305w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/05/screenshot_199.png?resize=300%2C38&amp;ssl=1 300w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/05/screenshot_199.png?resize=150%2C19&amp;ssl=1 150w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/05/screenshot_199.png?resize=200%2C25&amp;ssl=1 200w" sizes="(max-width: 305px) 100vw, 305px" data-recalc-dims="1" /></p>
<p>There you go. Simple pager for a great slideshow plugin.</p>
<p>The post <a href="https://sunarlim.com/2013/05/jquery-cycle-pager-style/">jQuery Cycle Pager Style as Dots with CSS</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sunarlim.com/2013/05/jquery-cycle-pager-style/feed/</wfw:commentRss>
			<slash:comments>6</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">778</post-id>	</item>
		<item>
		<title>Responsive Multi-level Menu to Dropdown</title>
		<link>https://sunarlim.com/2013/02/responsive-multi-level-menu-to-dropdown/</link>
					<comments>https://sunarlim.com/2013/02/responsive-multi-level-menu-to-dropdown/#respond</comments>
		
		<dc:creator><![CDATA[Michael]]></dc:creator>
		<pubDate>Wed, 27 Feb 2013 07:45:30 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[responsive]]></category>
		<guid isPermaLink="false">https://sunarlim.com/?p=728</guid>

					<description><![CDATA[<p>Thanks to this excellent tutorial from CSS-Tricks explaining how to create list-based menu into select dropdown on small screens, I was able to finally complete the product detail pages on Bluelounge website. My homework was not finished though. With around 20 active products on the website, I needed to preserve the product categories within the... <span class="more"><a class="more-link" href="https://sunarlim.com/2013/02/responsive-multi-level-menu-to-dropdown/">Continue reading <span class="meta-nav">&#8594;</span></a></span></p>
<p>The post <a href="https://sunarlim.com/2013/02/responsive-multi-level-menu-to-dropdown/">Responsive Multi-level Menu to Dropdown</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Thanks to <a href="http://css-tricks.com/convert-menu-to-dropdown/" target="_blank">this excellent tutorial from CSS-Tricks</a> explaining how to create list-based menu into select dropdown on small screens, I was able to finally complete the product detail pages on <a href="http://www.bluelounge.com/" target="_blank">Bluelounge website</a>. My homework was not finished though. With around 20 active products on the website, I needed to preserve the product categories within the dropdown menu to make it easier for visitors to check out other products. With some adjustments and a few extra lines of codes, it now works the way I wanted.<br />
<span id="more-728"></span></p>
<h3>Reading Requirement</h3>
<p>Before I begin, please first read the tutorial from CSS-Tricks to understand the initial concept: <a href="http://css-tricks.com/convert-menu-to-dropdown/" target="_blank">Convert a Menu to a Dropdown for Small Screens</a></p>
<h3>The HTML</h3>
<p>Here is the simplified HTML I use for the navigation:</p>
<pre class="lang:default decode:true ">&lt;ul id="list-products"&gt;
&lt;li class="category"&gt;&lt;h3&gt;Cable Management&lt;/h3&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/sumo/"&gt;Sumo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/cableboxmini/"&gt;CableBox Mini&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/cableclip/" &gt;CableClip&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/cabledrop/"&gt;CableDrop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/cablebox/"&gt;CableBox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/cableyoyo/"&gt;Cableyoyo&lt;/a&gt;&lt;/li&gt;
&lt;li class="category"&gt;&lt;h3&gt;Stands&lt;/h3&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/mika/"&gt;Mika&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/milo/"&gt;Milo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/nest/"&gt;Nest&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/notebookkit/"&gt;Notebook Kit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/coolfeet/"&gt;Cool Feet&lt;/a&gt;&lt;/li&gt;
&lt;li class="category"&gt;&lt;h3&gt;Chargers&lt;/h3&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/minidock/"&gt;MiniDock&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/refresh/"&gt;Refresh&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/extraconnectors/"&gt;Extra Connectors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/products/thesanctuary/"&gt;The Sanctuary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>I use <span class="lang:default decode:true crayon-inline ">class=&#8221;category&#8221;</span>  and <span class="lang:default decode:true crayon-inline ">&lt;h3&gt;&lt;/h3&gt;</span>  for list items that are categories. Since we do not have a category page, the list items do not have a link.</p>
<h3>jQuery</h3>
<p>The fun part was to modify the original code to only create dropdown options from list items with <code>class="category"</code> and then list the following option with the URL as value until it finds the next category title.<br />
Another code I added was to validate when changed if it has a (URL) value, otherwise it will not change the page.</p>
<pre class="lang:default decode:true">// Create the dropdown base
$("&lt;select /&gt;").appendTo(".productlist ");

// Create default option "Products."
$("&lt;option /&gt;", {
"selected": "selected",
"value" : "",
"text" : "Products"
}).appendTo(".productlist select");

// Populate dropdown with menu items
$(".productlist .category").each(function() { // List category titles
var el = $(this);
$("&lt;option /&gt;", {
"text" : el.text(),
"class" : "category" // Add class to the menu item
}).appendTo(".productlist select");
// Look for next items until there it finds another category title
$(this).nextUntil(".productlist .category").each(function() {
var li = $('a', this);
$("&lt;option /&gt;", {
"value" : li.attr("href"),
"text" : '- '+li.text()
}).appendTo(".productlist select");
});
});</pre>
<p>Done. For real-life example, you can view it on <a href="http://www.bluelounge.com/products/studiodesk" target="_blank">Bluelounge product page</a>.</p>
<p>The post <a href="https://sunarlim.com/2013/02/responsive-multi-level-menu-to-dropdown/">Responsive Multi-level Menu to Dropdown</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sunarlim.com/2013/02/responsive-multi-level-menu-to-dropdown/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">728</post-id>	</item>
		<item>
		<title>Creating &#8220;Sticky&#8221; Vertical Menu with jQuery Waypoints</title>
		<link>https://sunarlim.com/2013/02/creating-sticky-vertical-menu-with-jquery-waypoints/</link>
					<comments>https://sunarlim.com/2013/02/creating-sticky-vertical-menu-with-jquery-waypoints/#respond</comments>
		
		<dc:creator><![CDATA[Michael]]></dc:creator>
		<pubDate>Mon, 18 Feb 2013 03:32:31 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[bluelounge]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[navigation]]></category>
		<category><![CDATA[UI]]></category>
		<guid isPermaLink="false">https://sunarlim.com/?p=616</guid>

					<description><![CDATA[<p>Before last week, I had thought that making a sticky navigation would require a custom script and take a bit of time. By &#8220;sticky&#8221; it means an menu or element that is not always on top of the page but then sticks there after you scroll past a certain Y position. That was until I... <span class="more"><a class="more-link" href="https://sunarlim.com/2013/02/creating-sticky-vertical-menu-with-jquery-waypoints/">Continue reading <span class="meta-nav">&#8594;</span></a></span></p>
<p>The post <a href="https://sunarlim.com/2013/02/creating-sticky-vertical-menu-with-jquery-waypoints/">Creating &#8220;Sticky&#8221; Vertical Menu with jQuery Waypoints</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Before last week, I had thought that making a sticky navigation would require a custom script and take a bit of time. By &#8220;sticky&#8221; it means an menu or element that is not always on top of the page but then sticks there after you scroll past a certain Y position. That was until I found <a href="http://imakewebthings.com/jquery-waypoints/" target="_blank">jQuery Waypoints</a> which makes it very easy to trigger the change in the element&#8217;s CSS position value and make it look as it stays on the top of the page.<br />
<span id="more-616"></span></p>
<p>Unfortunately it is not the end of the challenge. From jQuery Waypoint&#8217;s <a href="http://imakewebthings.com/jquery-waypoints/shortcuts/sticky-elements/" target="_blank">example</a> and other tutorials I found, they only show how to apply it when you have horizontal elements. In my case, I wanted to use it for Bluelounge&#8217;s products menu which has vertical orientation and quite long. The way sticky menu works is by changing the CSS position from relative to fixed and our menu&#8217;s height is 854px. This means if the viewport is less than that, the bottom area of the menu will not be viewable at all.</p>
<div id="attachment_617" style="width: 610px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-617" class="size-full wp-image-617" alt="View from smaller screen" src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_01.jpg?resize=600%2C673&#038;ssl=1" width="600" height="673" srcset="https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_01.jpg?w=600&amp;ssl=1 600w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_01.jpg?resize=267%2C300&amp;ssl=1 267w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_01.jpg?resize=150%2C168&amp;ssl=1 150w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_01.jpg?resize=200%2C224&amp;ssl=1 200w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_01.jpg?resize=400%2C448&amp;ssl=1 400w" sizes="(max-width: 600px) 100vw, 600px" data-recalc-dims="1" /><p id="caption-attachment-617" class="wp-caption-text">View from smaller screen</p></div>
<p>The idea was to keep the &#8220;default behavior&#8221; when scrolling past the assigned waypoint but then change the CSS position value when it is near the end of the page, before the footer. With this approach, visitors can scroll through the bottom of the page and see the rest of the menu. Note that our product pages are mostly not too long, so this solution could still be considered. If you have very long pages, then I would not recommend it because your users will have to scroll a lot before they can see the rest of the menu.</p>
<div id="attachment_620" style="width: 610px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-620" class="size-full wp-image-620" alt="When reaching the bottom of the page." src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_02.jpg?resize=600%2C420&#038;ssl=1" width="600" height="420" srcset="https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_02.jpg?w=600&amp;ssl=1 600w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_02.jpg?resize=300%2C210&amp;ssl=1 300w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_02.jpg?resize=150%2C105&amp;ssl=1 150w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_02.jpg?resize=200%2C140&amp;ssl=1 200w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2013/02/vertical_waypoints_02.jpg?resize=400%2C280&amp;ssl=1 400w" sizes="(max-width: 600px) 100vw, 600px" data-recalc-dims="1" /><p id="caption-attachment-620" class="wp-caption-text">When reaching the bottom of the page.</p></div>
<p>So, how to achieve this? We need to create two waypoints: one at the start of the content (after header) and one at the end of the content (before footer).</p>
<h3>The Codes</h3>
<p>Here is the simplified version of page HTML structure:</p>
<p>[syntax_prettify linenums=&#8221;linenums&#8221;]<br />
&lt;div class=&quot;wrapper&quot; id=&quot;products&quot;&gt;<br />
  &lt;div class=&quot;container_16&quot;&gt;<br />
    &lt;div class=&quot;header&quot;&gt;<br />
      &lt;!&#8211; Header Content &#8211;&gt;<br />
    &lt;/div&gt;<br />
    &lt;div class=&quot;pagecontent sidebar&quot;&gt;<br />
      &lt;div class=&quot;grid productlist&quot;&gt; &lt;!&#8211; wrapper for menu &#8211;&gt;<br />
        &lt;!&#8211; start: Product Menu &#8211;&gt;<br />
        &lt;ul id=&quot;list-products&quot;&gt;<br />
          &lt;li class=&quot;category&quot;&gt;&lt;h3&gt;Cable Management&lt;/h3&gt;&lt;/li&gt;<br />
          &lt;li class=&quot;cable-management&quot;&gt;&lt;a href=&quot;/products/sumo/&quot; title=&quot;Sumo: A Heavyweight for small cables&quot;&gt;&lt;span&gt;Sumo&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;<br />
          &lt;li class=&quot;cable-management&quot;&gt;&lt;a href=&quot;/products/cableboxmini/&quot; title=&quot;CableBox Mini: Liven up your space&quot;&gt;&lt;span&gt;CableBox Mini&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;<br />
          &lt;li class=&quot;cable-management&quot;&gt;&lt;a href=&quot;/products/cableclip/&quot; title=&quot;CableClip: Sleek, minimalist design solution for managing cables of all sizes&quot;&gt;&lt;span&gt;CableClip&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;<br />
          &lt;li class=&quot;category&quot;&gt;&lt;h3&gt;Desks&lt;/h3&gt;&lt;/li&gt;<br />
          &lt;li class=&quot;desks&quot;&gt;&lt;a href=&quot;/products/studiodesk/&quot; title=&quot;StudioDesk: A traditional workspace with a modern twist&quot;&gt;&lt;span&gt;StudioDesk&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;<br />
        &lt;/ul&gt;<br />
        &lt;!&#8211; end: Product Menu &#8211;&gt;<br />
        &lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;<br />
      &lt;/div&gt;<br />
      &lt;div class=&quot;grid details&quot;&gt;<br />
        &lt;!&#8211; Page Content &#8211;&gt;<br />
      &lt;/div&gt;<br />
      &lt;div class=&quot;clearfix&quot;&gt;&lt;/div&gt;<br />
    &lt;/div&gt;<br />
  &lt;/div&gt;<br />
&lt;/div&gt;</p>
<p>&lt;div class=&quot;footer&quot;&gt;<br />
  &lt;!&#8211; Footer Content &#8211;&gt;<br />
&lt;/div&gt;<br />
[/syntax_prettify]</p>
<p>And here is the JS code:</p>
<p>[syntax_prettify linenums=&#8221;linenums&#8221;]<br />
$(&#8216;.productlist&#8217;).waypoint({<br />
  handler: function(direction) {<br />
    $(&#8216;#list-products&#8217;).toggleClass(&#8216;sticky-top&#8217;); //change position to fixed by adding &#8216;sticky-top&#8217; class<br />
  }<br />
});<br />
$(&#8216;.footer&#8217;).waypoint({<br />
  offset: $(&#8216;#list-products&#8217;).height()+20, //calculate menu&#8217;s height and margin before footer<br />
  handler: function(direction) {<br />
    $(&#8216;#list-products&#8217;).toggleClass(&#8216;sticky-top&#8217;); //remove &#8216;sticky-top&#8217; class<br />
    $(&#8216;.productlist&#8217;).toggleClass(&#8216;sticky-bottom&#8217;); //change position to absolute for the wrapper<br />
  }<br />
});<br />
[/syntax_prettify]</p>
<p>Finally the simplified CSS code:</p>
<p>[syntax_prettify linenums=&#8221;linenums&#8221;]<br />
.sticky-top {<br />
  position: fixed;<br />
  top: 0;<br />
}</p>
<p>.sticky-bottom {<br />
  position: absolute;<br />
  bottom: 0;<br />
}<br />
[/syntax_prettify]</p>
<h3>The Logics</h3>
<p>As I have mentioned, Waypoints is really making things easy by allowing you to set your &#8216;anchors&#8217; within the page. So in line 1 of the JS, when the scroll hits <em>&lt;div class=&quot;productlist&quot;&gt;</em> it will toggle a new class <em>sticky-top</em> for the menu which changes the CSS position to <em>fixed</em> and make it stick to the top of the page.</p>
<p>The harder part is to tell the script that after reaching another waypoint, it has to remove the <em>sticky-top</em> class from the menu and make the menu&#8217;s wrapper stick to the end of the page&#8217;s content. To do this, we first need to calculate the position of the other waypoint. For this, we have to make use the <em>offset</em> option.</p>
<p>From Waypoints documentation:<br />
<strong>Offset</strong><br />
This option determines how far the top of the element must be from the top of the viewport to trigger the callback function.</p>
<p>Since the <em>&lt;div class=&quot;footer&quot;&gt;</em> is the element that we want to set as the new waypoint, we have to add the offset with the height of the menu by using jQuery&#8217;s height() function. I also added an extra 20px because there is 20px bottom margin from the page content to the footer.</p>
<h3>Real-life usage</h3>
<p>You can see the result on <a href="http://www.bluelounge.com/products/milo/" target="_blank" style="text-decoration: line-through;">Bluelounge product page</a>. Inside the product page, there are also other scripts running like the tabs and masonry so I have to add additional steps to make all of them work nicely together. But I am not going to the details and will save it for another time.</p>
<p>The technique is not perfect yet, you can probably still notice the page jumps a little. Not to mention a certain minimum height of the viewport is still required, which is half of the menu, so on very small desktop screens this will not work optimally. For now, I am quite happy with this and welcoming any suggestion to improve it further.</p>
<p><strong>Note:</strong> New <a href="http://www.bluelounge.com/" target="_blank">Bluelounge website</a> launched in the beginning of 2015, therefore the result link above is no longer working.</p>
<p>The post <a href="https://sunarlim.com/2013/02/creating-sticky-vertical-menu-with-jquery-waypoints/">Creating &#8220;Sticky&#8221; Vertical Menu with jQuery Waypoints</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sunarlim.com/2013/02/creating-sticky-vertical-menu-with-jquery-waypoints/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">616</post-id>	</item>
		<item>
		<title>Contactable jQuery Plugin on The Right Side of Page</title>
		<link>https://sunarlim.com/2010/03/contactable-jquery-plugin-on-the-right-side-of-page/</link>
					<comments>https://sunarlim.com/2010/03/contactable-jquery-plugin-on-the-right-side-of-page/#comments</comments>
		
		<dc:creator><![CDATA[Michael]]></dc:creator>
		<pubDate>Thu, 11 Mar 2010 18:21:16 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://sunarlim.com/?p=297</guid>

					<description><![CDATA[<p>Contactable is a great jQuery plugin by Philip Beel to include a nice sliding contact form, even if you only understand a tiny bit of jQuery and PHP. I needed to use this plugin for one of my project, but I want it to be on the right side of the page instead of left.... <span class="more"><a class="more-link" href="https://sunarlim.com/2010/03/contactable-jquery-plugin-on-the-right-side-of-page/">Continue reading <span class="meta-nav">&#8594;</span></a></span></p>
<p>The post <a href="https://sunarlim.com/2010/03/contactable-jquery-plugin-on-the-right-side-of-page/">Contactable jQuery Plugin on The Right Side of Page</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="http://theodin.co.uk/blog/ajax/contactable-jquery-plugin.html" target="_blank">Contactable</a> is a great jQuery plugin by <a href="http://theodin.co.uk/" target="_blank">Philip Beel</a> to include a nice sliding contact form, even if you only understand a tiny bit of jQuery and PHP.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-298" title="contactableHeader1" src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2010/03/contactableHeader1.png?resize=608%2C124&#038;ssl=1" alt="" width="608" height="124" srcset="https://i0.wp.com/sunarlim.com/wp-content/uploads/2010/03/contactableHeader1.png?w=608&amp;ssl=1 608w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2010/03/contactableHeader1.png?resize=300%2C61&amp;ssl=1 300w" sizes="(max-width: 608px) 100vw, 608px" data-recalc-dims="1" /></p>
<p>I needed to use this plugin for one of my project, but I want it to be on the right side of the page instead of left. In order to do this, you need to change a small portion of the CSS and JS files. No special skills required. Still, you can save your time since you can download it directly below:</p>
<p><a href="https://sunarlim.com/wp-content/uploads/2010/03/contactable_right.zip">» click here to download Contactable on right side of page «</a></p>
<p>All credits go to Philip Beel. Instructions and demo can be checked directly on <a href="http://theodin.co.uk/blog/ajax/contactable-jquery-plugin.html" target="_blank">this plugin&#8217;s homepage</a>.</p>
<p>The post <a href="https://sunarlim.com/2010/03/contactable-jquery-plugin-on-the-right-side-of-page/">Contactable jQuery Plugin on The Right Side of Page</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sunarlim.com/2010/03/contactable-jquery-plugin-on-the-right-side-of-page/feed/</wfw:commentRss>
			<slash:comments>27</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">297</post-id>	</item>
		<item>
		<title>Top Five jQuery Plugins For Any Project</title>
		<link>https://sunarlim.com/2010/02/top-five-jquery-plugins-for-any-project/</link>
					<comments>https://sunarlim.com/2010/02/top-five-jquery-plugins-for-any-project/#comments</comments>
		
		<dc:creator><![CDATA[Michael]]></dc:creator>
		<pubDate>Thu, 18 Feb 2010 17:51:35 +0000</pubDate>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://sunarlim.com/?p=254</guid>

					<description><![CDATA[<p>I am probably the ten billionth person who says this, but jQuery this just GREAT! By spending a few extra minutes you can add so much interaction to your website. It is so easy to understand and use, you do not even need to be able to create your own. So many plugins out there... <span class="more"><a class="more-link" href="https://sunarlim.com/2010/02/top-five-jquery-plugins-for-any-project/">Continue reading <span class="meta-nav">&#8594;</span></a></span></p>
<p>The post <a href="https://sunarlim.com/2010/02/top-five-jquery-plugins-for-any-project/">Top Five jQuery Plugins For Any Project</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I am probably the ten billionth person who says this, but <strong><a href="http://jquery.com" target="_blank">jQuery</a></strong> this just GREAT! By spending a few extra minutes you can add so much interaction to your website. It is so easy to understand and use, you do not even need to be able to create your own. So many plugins out there that can make life so much easier. Here are five plugins that are not only nice, but also easy to implement:<span id="more-254"></span></p>
<h3><a href="http://www.fancybox.net" target="_blank">Fancybox</a></h3>
<p>FancyBox is a tool for displaying images, html content and multi-media in a Mac-style &#8220;lightbox&#8221; that floats overtop of web page.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-255" title="Fancybox" alt="Fancybox sample" src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2010/02/screenshot_01-e1266514377606.jpg?resize=500%2C335&#038;ssl=1" width="500" height="335" data-recalc-dims="1" /></p>
<h3><a href="http://www.dfc-e.com/metiers/multimedia/opensource/jqtransform/" target="_blank">Jqtransform</a></h3>
<p>This plugin is a jQuery styling plugin wich allows you to skin form elements.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-256" title="Jqtransform" alt="Jqtransform sample" src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2010/02/screenshot_02-e1266514595236.jpg?resize=500%2C520&#038;ssl=1" width="500" height="520" data-recalc-dims="1" /></p>
<h3><a href="http://buildinternet.com/project/supersized/" target="_blank">Supersized</a></h3>
<p>Supersized resizes images to fill browser while maintaining image dimension ratio, cycles Images/backgrounds via slideshow with transitions and preloading.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-257" title="Supersized" alt="Supersized image" src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2010/02/screencap.jpg?resize=470%2C160&#038;ssl=1" width="470" height="160" srcset="https://i0.wp.com/sunarlim.com/wp-content/uploads/2010/02/screencap.jpg?w=470&amp;ssl=1 470w, https://i0.wp.com/sunarlim.com/wp-content/uploads/2010/02/screencap.jpg?resize=300%2C102&amp;ssl=1 300w" sizes="(max-width: 470px) 100vw, 470px" data-recalc-dims="1" /></p>
<h3><a href="http://flowplayer.org/tools/scrollable.html" target="_blank">Scrollable</a></h3>
<p>The purpose of this library is to make it extremely easy to add scrolling functionality to a website. Whenever you wish to scroll HTML elements in a visually-appealing manner, this is the only library you need. The main design goals of this library are to provide <em>visual customization</em> functionality and <em>programmability</em>.</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-258" title="Scrollable" alt="Scrollable screenshot" src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2010/02/screenshot_03-e1266515041134.jpg?resize=500%2C348&#038;ssl=1" width="500" height="348" data-recalc-dims="1" /></p>
<h3><a href="http://code.drewwilson.com/entry/tiptip-jquery-plugin" target="_blank">TipTip</a></h3>
<p>TipTip is a very lightweight and intelligent custom tooltip jQuery plugin. It uses ZERO images and is completely customizable via CSS. It&#8217;s also only 3.5kb minified!</p>
<p><img loading="lazy" decoding="async" class="aligncenter size-full wp-image-259" title="TipTip" alt="TipTip image" src="https://i0.wp.com/sunarlim.com/wp-content/uploads/2010/02/screenshot_04-e1266515249743.jpg?resize=500%2C161&#038;ssl=1" width="500" height="161" data-recalc-dims="1" /></p>
<p>Kudos for the programmers who developed these great plugins!</p>
<p>The post <a href="https://sunarlim.com/2010/02/top-five-jquery-plugins-for-any-project/">Top Five jQuery Plugins For Any Project</a> appeared first on <a href="https://sunarlim.com">Michael Sunarlim</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sunarlim.com/2010/02/top-five-jquery-plugins-for-any-project/feed/</wfw:commentRss>
			<slash:comments>14</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">254</post-id>	</item>
	</channel>
</rss>
