RSS
 

Archive for the ‘Web Design’ Category

jQuery accordion

01 Dec

Resources

For this tutorial I will try to exclude the use of any unnecessary file and will stick to the basic, feel free to add and customize your project as you wish.

  1. For jQuery library I used Google Code AJAX Libraries API
  2. Text / Code editor. I used Notepad++, my personal favorite for fast editing / coding.
  3. Some free time and curious mentality

Building the HTML Structure

I’m assuming you know HTML and CSS as I will not explain what each tag does.

<ul id="accordion">
  <li>
  <a href="#">Item 1</a>
 <ul>
  <li><a href="http://muiomuio.net/category/wordpress-themes/" target="_blank" title="WordPress Themes (external link)">WordPress Themes</a></li>
  <li><p>This is a paragraph with some text</p></li>
  <li><a href="http://twitter.com/mariorandrade/" target="_blank" title="Twitter (external link)"><img src="http://muiomuio.com/wp-content/themes/lightword/images/mariorandrade.png" alt="Follow me on Twitter" title="Don't forget to follow me on twitter" /></a></li>
  </ul>
  </li>
 <li>
  <a href="#">My Skills</a>
  <ul>
  <li>HTML / XHTML, CSS</li>
  <li>Adobe Photoshop, Fireworks</li>
  <li>PHP, jQuery, Ruby on rails</li>
  <li>And a whole lot more</li>
  </ul>
  </li>
  <li><a href="http://muiomuio.com/web-design/jquery-accordion/" target="_blank">jQuery Accordion tutorial</a></li>
  <li>
  <a href="#">Resources</a>
 <ul>
  <li><a href="http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery" target="_blank">Google jQuery link</a></li>
  <li><a href="http://docs.jquery.com/Tutorials" target="_blank">More jQuery tutorials</a></li>
  </ul>
  </li>
  </ul>

As you can see I created an unordered list with the ID accordion. Inside that list I have a link that works as header to the content inside. The content is hold inside other unordered lists.

Adding the jQuery

Personally I add all javascript at the bottom of the page right after the </body> tag due to accessibility and usability purposes.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
  <script type="text/javascript">
function Accordion() {
  $('#accordion ul').hide(); // hide all unordered lists inside the accordion list
  $('#accordion ul:first').show(); //show the first unordered list inside the accordion
  $('#accordion li a').click(
  function() {
  var checkElement = $(this).next();
  if((checkElement.is('ul')) && (checkElement.is(':visible'))) { //if you click on an unordered list and this list is opened (visible)
  return false; //nothing happens
  }
  if((checkElement.is('ul')) && (!checkElement.is(':visible'))) { //if you click on an unordered list and this list is not opened (visible)
  $('#accordion ul:visible').slideUp('normal'); // the list that is visible will close (slideUp)
  checkElement.slideDown('normal'); //the list you clicked will open (slideDown)
  return false;
  }
  }
  );
  }
  $(document).ready(function() {Accordion();}); //when the document is ready to load the script it iniciates the function
</script>

Now you have your accordion built and functional you need to give it some visual appeal.

Adding CSS to jQuery Accordion

<style type="text/css">
ul#accordion {
  padding:0;
  border:1px solid #ececec;
  width:200px;
  }
ul#accordion li a {
  background:#222;
  padding:0.5em;
  display:block;
  color:#ececec;
  font-weight:bold;
  font:0.8em Verdana, Arial, Helvetica, sans-serif;
  text-decoration:none;
  }
ul > li {
  list-style:none;
  padding:0;
  margin:0;
  }
ul#accordion li ul {
  margin:0;
  padding:0;
  }
ul#accordion li ul li {
  padding:2px;
  margin:0;
  border-bottom:1px dashed #ccc;
  font:0.8em Verdana, Arial, Helvetica, sans-serif;
  }
ul#accordion li ul li a {
  padding:5px 0;
  font:0.8em Verdana, Arial, Helvetica, sans-serif;
  color:#222;
  background:none;
}
ul#accordion li ul li a:hover {
  color:#C90;
  }
</style>

And there you go. This is a very simple, valid and accessible jQuery vertical accordion tutorial. Feel free to play with the CSS. It’s easily adapted to an horizontal accordion.

If you liked this tutorial please help spreading the word by sharing this tutorial with other users. Thanks in advanced.

 
 

Quickstart on prototyping with wireframes

29 Nov

I’ve always believed that work should be fluid. For example, when I’m looking at a visual specification I want to be able to press the title of a news and go to that news article page specification instead of having to scroll to it.
The following video shows you how to create a click-able prototype with Adobe inDesign. Basically what happens is you create buttons and behaviors on inDesign and export it as a Swift (.swf) file. You can than open the SWF file on your browser and navigate through the different pages by clicking on the buttons you created.

 
1 Comment

Posted in Web Design

 

How Twitter and Facebook will revolutionize the mobile industry

14 Nov

The first website I visited was Twitter and I was excited, I logged in and I was able to tweet and see the tweets of people I follow but unfortunately I was not able to see the links they shared in conditions since they have no mobile version. It was really frustrating waiting over 5 minutes for a page to load and just to get a message saying “Memory is full” when I tried to access Abduzeedo.com

Fortunately some websites like Smashing Magazine have a mobile version of their website and I was able to read an article, many other websites have great designs, awesome content but lack on mobile support.

Twitter is already accessed via mobile by thousands of users and provides a valuable service to many businesses.
Facebook is the World most active community with a strong base to develop new applications and capitalize on their own market. Mobile applications and businesses based on mobile web design and application development are already a reality.

As the mobile web, social websites and services grow I believe that mobile versions of websites will be a must in about 5 years time, maybe less depending on technological breakthroughs. It took
It’s time for bloggers and businesses to start thinking, testing and creating mobile experiences and improving their user / customer experience when accessing their services or websites through mobile devices.

More on Mobile Web

Cameron Moll’s book Mobile Web Design is a very interesting reading and I truly recommend it to any front-end web developer. You can grab a preview sample of Mobile Web Design.

WordPress Mobile Plugins:

Joomla Mobile Extensions:

I would like to ask you to share tools, thoughts, methodologies or tutorials you might know regarding the mobile web. What are your thoughts on the emerging trend of accessing internet with mobile devices?

photo by (bee) is too busy

 
 

Check if email domain exists with PHP

04 Oct

So let’s create a function to allow you to check the dns record of a full email address:

function VerifyEmailAddress($email) {
    list($user, $domain) = explode("@", $email);
    $result = checkdnsrr($domain, 'MX');
    return($result);
}

This function breaks the email string example@domain.tld giving the username the the content before @ and the domain the content after the @.
If you insert an email like example@domain.tld the user would be example and the domain would be domain.tld.

After breaking the email into user and domain the function calls checkdnsrr to check is the MX records on the $domain variable returning 1 is the domain exists or 0 if the domain does not exist.

Now you need to call it when checking an email:

if(VerifyEmailAddress($email) != 1) {
    echo "The e-mail you inserted is not valid.";
}

And here you have it. You can now check if the domain of an email exists.
For complete email verification I advise you to implement the following functions:

  • Check if email string inserted is a correct email for. Must have string@string.com
  • Check if the email domain exists. You can use this tutorial for that
  • Limit the amount of tries, for a determined period of time, a user can insert an email in order to stop possible spam bots
 
 

How to remove Google Maps Info Window

30 Sep

Fortunately I was able to easily understand that the tooltip is called by using a variable named iwloc which is used to specify where the infowindow A.K.A info bubble, info ballon or info tooltip.
You can read more about the iwloc variable and it’s properties at mapki wiki about Google Map Parameters on the Info Windows Section

Important Note:

Two days after writing this post I was unable to view the Info Window (info ballon) when the page is loaded. If you wish to know what the Info Window is, left click on top of any pinpoint and it will show.

Here is an example of what I mean:


View Larger Map

You can imagine why clients wouldn’t want this info window showing up on a map at their website. But unfortunately removing this info window is not as simple as removing the iwloc var from the code google maps gives you to embed the map on your website.

Here is the code that shows the map above:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=google+headquarters&amp;sll=37.42285,-122.080078&amp;sspn=0.008043,0.01929&amp;ie=UTF8&amp;radius=0.53&amp;filter=0&amp;rq=1&amp;ev=p&amp;t=h&amp;cid=5377921459564608739&amp;ll=37.431251,-122.076902&amp;spn=0.023855,0.036478&amp;z=14&amp;iwloc=A&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=google+headquarters&amp;sll=37.42285,-122.080078&amp;sspn=0.008043,0.01929&amp;ie=UTF8&amp;radius=0.53&amp;filter=0&amp;rq=1&amp;ev=p&amp;t=h&amp;cid=5377921459564608739&amp;ll=37.431251,-122.076902&amp;spn=0.023855,0.036478&amp;z=14&amp;iwloc=A" style="color:#0000FF;text-align:left">View Larger Map</a></small>

I highlight the iwloc variable but now if I remove it. Here is what I get:


View Larger Map

Here is the code I used to show the map above:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=google+headquarters&amp;sll=37.42285,-122.080078&amp;sspn=0.008043,0.01929&amp;ie=UTF8&amp;radius=0.53&amp;filter=0&amp;rq=1&amp;ev=p&amp;t=h&amp;cid=5377921459564608739&amp;ll=37.431251,-122.076902&amp;spn=0.023855,0.036478&amp;z=14&amp;&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=google+headquarters&amp;sll=37.42285,-122.080078&amp;sspn=0.008043,0.01929&amp;ie=UTF8&amp;radius=0.53&amp;filter=0&amp;rq=1&amp;ev=p&amp;t=h&amp;cid=5377921459564608739&amp;ll=37.431251,-122.076902&amp;spn=0.023855,0.036478&amp;z=14&amp;" style="color:#0000FF;text-align:left">View Larger Map</a></small>

I removed the iwloc variable and I noticed this works on some maps, on others you have to endorse other strategies.

After reading the Google Map Paremeters information about the iwloc variable I started trying the different values you can apply and I found that using iwloc=near; does what I want: The map shows up with the pinpoint and no Info Window, if I click on the pinpoint the Info Windows shows up. Perfect!


View Larger Map

Here is the code I used to create the map you see above:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=google+headquarters&amp;sll=37.42285,-122.080078&amp;sspn=0.008043,0.01929&amp;ie=UTF8&amp;radius=0.53&amp;filter=0&amp;rq=1&amp;ev=p&amp;t=h&amp;cid=5377921459564608739&amp;ll=37.431251,-122.076902&amp;spn=0.023855,0.036478&amp;z=14&amp;iwloc=near&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=google+headquarters&amp;sll=37.42285,-122.080078&amp;sspn=0.008043,0.01929&amp;ie=UTF8&amp;radius=0.53&amp;filter=0&amp;rq=1&amp;ev=p&amp;t=h&amp;cid=5377921459564608739&amp;ll=37.431251,-122.076902&amp;spn=0.023855,0.036478&amp;z=14&amp;iwloc=near" style="color:#0000FF;text-align:left">View Larger Map</a></small>

And voilá! Just don’t forget when applying a Map make sure on Google Maps you right click and set the map to center on that spot by clicking on Center Map Here:

How to Center Google Maps

The Final Result:


View Larger Map

 
1 Comment

Posted in Web Design

 
 

Page optimized by WP Minify WordPress Plugin