5 Web Design Tips for Creating a Great Ecommerce Site

posted on March 4, 2022

tags:

No matter how excellent your products may be or how carefully you’ve planned out your marketing strategy, a poorly designed website can stunt your business growth in an instant. The fact of the matter is, it only takes a few seconds for an online visitor to form an impression and decide whether to keep browsing on your site or to leave and find a more user-friendly website. As such, having an attractive, clear and concise eCommerce site is imperative today. To help you maximize conversions and retain customers, here are a few of our top web design tips for creating a great eCommerce site.

1. Embrace Minimalism

Although minimalism is typically used to describe interior design, it’s becoming a significant trend in web design. Keeping things clear, uncluttered, and straightforward in our hectic, modern world is essential. And when it comes to designing an eCommerce website where there’s usually a range of products and categories, it’s even more crucial to keep it simple. So this year, strip away anything that might make your site look overwhelming or busy and get straight to the point. All of those extra bells and whistles only create distractions, which reduces the chance of visitors purchasing something from your online store. So instead, stay focused on the sale and make it easy to navigate by keeping it attractive.

2. Nail Your Branding

These days, online users are much more cautious than ever before about handing over their personal info and credit cards due to the overwhelming presence of online scams. For this reason, establishing trust with your customer base is fundamental for creating a successful online store. In order to do this, your branding needs to be polished and on point. This means putting the time into nailing the look and tone of your brand and keeping it consistent. It’s also a crucial part of setting your store apart from the crowd and creating an emotional connection with people, the key to driving sales. If you haven’t already, make an effort to prioritize your branding, so you understand your business identity and which avatars you’re targeting.

3. Do the “Grandma” Test

If you’re planning to target certain generations, like the Baby Boomers, keep in mind that many shoppers aren’t as comfortable online or are just starting to get familiar with the concept of eCommerce. That’s why having an easy, user-friendly layout is essential. To ensure your site hits the mark, perform the “grandma” test. Ask a friend or relative to browse your website to see if it’s easy to navigate or if it could use some improvements. Ask them to be honest with their feedback, as this will help you improve the functions on your site to improve retention. If it’s not clear or easy to use, you could be missing out on a lucrative niche of shoppers.

4. Don’t Cheap Out on Imagery

The quality of images used on websites can directly impact conversion rates. And since consumers can see or touch the offered products, they have to rely on your photos to determine if it’s worth the money. If you’re using images that are blurry or insufficient, no one is going to trust it. This is why having professional, high-quality photos are even more important for eCommerce businesses.

5. Keep Text to a Minimum

Conveying your passion for the products that you’re selling is great, but the truth is most people don’t have the time to stop and read through long descriptions. Instead, online users today want to scan through quickly and find the key bits of info they need to make a decision. So focus on getting your point across, break up your content into small sections, and keep it to a minimum. Also, segregate sections clearly using large, bold fonts and distinguishing your CTAs. Remember, the simpler it is, the better your chances of converting sales.

Above all, your eCommerce site needs to look professional, which can be tricky if you’re trying to manage several roles in your start-up and don’t have experience in web development. But that’s where we can help! Hire top web development freelancers at Goodie Website. This way, you can avoid pricey overhead costs and get the expert support you need to enable your online store to flourish.

The post 5 Web Design Tips for Creating a Great Ecommerce Site appeared first on SiteProNews.

What Causes the Bounce Rate on Your Website?

posted on February 23, 2022

tags:

A website’s bounce rate is calculated by dividing the total of one-page sessions by the total of page visits.

41-55 percent is average, anything over 70% becomes disappointing, except for blogs and news websites.

Image supplied by Author

And if yours is going below this, there are some serious problems that you need to fix. So without any further ado, let’s get started.

1. Bot Traffic

Bot traffic is a non-human traffic that is also an addition to your website’s metric.

When your landing page doesn’t perform well or you experience a high bounce rate on ads, bot traffic could be the culprit.

These bots can be automated to click on ads and visit websites as targeted humans. And guess what? Up to 29% of ad clicks can be accredited to bot action.

And if you as a marketer knows this, then a 45% bounce rate would not bother you.

This is because you know that every website visitor or traffic is not real.

The bots are automated to copy, paste, or scan information from web pages.

Up to 52% of website traffic in 2016 was bot traffic and this was staggering.

And this would have resulted in a large number of bounce rates for websites.

When you run ads online, these bots can result in ad revenue loss.

They are the reason you get unreal data when trying to measure your website’s bounce rate.

So bear in mind that not all website traffic is human traffic.

2. Speed Issues

A landing page load time can cause an increase in bounce rate. After all, our generation has an average attention span of 12-8 seconds.

With a 12-second attention span, it’s necessary to have your landing page loading faster.

It’s likely that the more pages a visitor views, the more likely he or she is going to add one of the items on a page to their cart.

This means that a faster-loading eCommerce website would get more items on the cart and that’s an increase in revenue.

But end-users indeed have different connection speeds, especially on mobile devices.

So it’s necessary to optimize your website speed for desktop as well as mobile phones.

Large eCommerce companies constantly optimize the speed of their landing pages to have an advantage.

Image supplied by Author

Amazon for example reports over 1% decrease in sales when their page loading speed was 100ms slower than expected.

This means that the faster website pages load, the more time visitors would spend clicking on different web pages.

And when visitors begin to go through your website because of how fast pages load, your bounce rate gets lower.

3. Poor User Experience

Anyone who clicks your ad is trying to solve a problem. Your landing page design should focus on solving their problem.

Avoid distractions like pop-ups on your landing page. Otherwise, web visitors would definitely leave the website.

It could also be that your landing page layout, your colors, your design, and your copywriting are not well optimized.

The user experience is essential in converting a website visitor into a customer.

If your site is populated with messy, incorrect, irrelevant, or boring content and design, your ad clicks will bounce.

This would result in a low conversion rate.

An old-looking landing page can tell a visitor a lot about your business, especially when you’ve irrelevant images.

4. Weak or No Call-to-Action

Once a visitor clicks on your ad and goes through your landing page, they go through a decision-making process.

And when it’s time to move on to the next step, you need a clear and precise call to action to make that happen.

Every element matters when optimizing the perfect call to action.

Even the text color could double your click-through rate.

When users click the call to action and move over to the next page, this reduces your bounce rate.

It’s a must to have a call to action if you are trying to reduce your bounce rate.

If you don’t show where your visitors should go next, they might instantly hop on to your competitor’s website.

5. Low-Quality Content

Dollars literally fly out of the window when visitors bounce off due to poor quality content or copywriting.

This could be a lack of readability or when your content isn’t clear and concise.

Poor quality landing pages – or lack of landing pages – often cause a high bounce rate. If a customer doesn’t see what they’re looking for quickly, they’re more likely to bounce.

If they don’t see what they want, it’s easy to move over to a competitor’s website to get the problem solved.

They might get a poor impression of the company’s message and might be triggered to click off the landing page.

If your landing page content doesn’t answer the questions of your visitors, they might bounce off. And eventually, your conversion rate would get hurt.

6. Technical Error

Maybe your JavaScript is malfunctioning or visitors are hitting some sort of roadblock on your landing page.

Technical errors could be another reason why visitors are leaving your landing page.

It could also be that a website form is not loading, which can sometimes be a popular problem with websites.

These errors can exist on your site without you really figuring out what’s wrong.

If your site is quite small, you can test this on your own.

Try accessing your landing page through different devices and browsers or you can use Google search control if you have a bigger site.

7. Poorly Targeted Traffic

When you are getting the wrong visitors on your landing page, they can increase your bounce rate.

If your ad isn’t being shown to the right audience, it attracts the wrong clicks to your landing page.

This can include poor targeting, bad ad placements or not segmenting your campaigns by customer intent.

Try to define your target demographic, and get as granular as possible. This will allow you to display your ads to people who are most likely interested in your product or service.

General ad targeting can be costly and will likely result in a high bounce rate.

How Can We Get A Good Bounce Rate?

Run a manual landing page analysis and identify that page from your funnel which has the most bounce rate. Isolate it and run an analysis of the metrics.

Look at the page design, go through the page like a visitor, identify, and take relevant notes.

Along with this, you can apply these mini tips:

Get High-Value Traffic: Show your ads to the right audience, If you are using Google or Facebook PPC ad campaigns, refine your audience.

Write A Relevant Advertising Copy: Write ads that are relevant to your audience and narrow down your demographics deeply.

Use Heatmaps: Heatmaps show you what users are doing when they visit your website, you can see where visitors spend their time the most, and you can strategically add a call to action there.

Optimize Landing Page Speed: Test your speed at GTmetrix and keep optimizing unless you get a good result.

Filter out invalid traffic: Bots are a constant problem and one that requires a technical solution. Software for click fraud prevention is the best way to reduce your exposure to clicks from non-genuine traffic.

The Bottom Line

You have mostly figured out that reducing your bounce rate is not a lone endeavor.

The measurements you need to figure out before you can reduce your bounce rate require a series of processes.

These processes and solutions are not the same for every business.

What works for you might not work for another business. All in all, it’s all about observing, tweaking, and making it better over a period of time.

The post What Causes the Bounce Rate on Your Website? appeared first on SiteProNews.

The Key Relation Between UX Design and Website Traffic

posted on February 14, 2022

tags:

Millions of websites are operating on the Internet as of now. Do you fear that your brand’s website might not be noticed among the crowd? Unfortunately, that has been the case for numerous businesses. Many companies either revamped or closed down their entire web presence because of no or low traffic. Not all websites manage to attract enough users, after all.

Now, the main question: What makes a website successful? The success of a website is measured by the number of its visitors and their conversion rate. What can you do to bring more traffic to your website? Well, the answer is quite simple; provide your users a great experience!

This blog first describes user experience and highlights its importance. Then it covers how a good user experience drives traffic to your website. Finally, it explains the process of ensuring an effective UX design. Let’s get started.

What is User Experience (UX) Design?

User Experience refers to the overall experience of a user when using your website. UX Design means a website design built to enhance user satisfaction. Satisfying users requires an in-depth analysis of what they need or value, how they interact with your website, and how they feel over each interaction.

User Experience (UX) is often confused with User Interface (UI). However, users do not just need an interactive digital interface for a good experience on a website. There are various other aspects involved, like visual design, information architecture, content strategy, and usability.

Why Does It Matter?

Would you revisit a website if it takes too long to load? How about websites that have confusing navigation or low-quality graphics? Nobody likes to deal with such poorly designed websites.

People nowadays have very short attention spans. They abandon a website immediately if it fails to appeal to them within the first few minutes of their use. Even search engines like Google do not index such websites anymore.

Therefore, websites with slow user interfaces, difficult navigation, or average content do not survive in the market for long. It’s high time for businesses now to level up their user experience game.

How Does User Experience Design Increase Traffic?

User Experience Design is all about ensuring a worthwhile experience for your users. People will definitely revisit your website if they have a positive experience the first time.

Let’s see how the elements of UX design attract people and convert them into actual customers.

1. The First Impression

The first few seconds after a user clicks on your website are crucial. Users will only continue further if the landing page loads quickly. Plus, the home page content (including text and graphics) needs to impress them at the first glance. You have to make the best use of typography, expressive images, colors, fonts, etc. Users explore a website further only when the landing page is quick, readable, and attractive.

2. Mobile Optimization

Gone are the days when people had to use a PC to access the Internet. Now almost everything happens on mobiles! People mostly surf the Internet on the go. Therefore, your website will lose maximum traffic if it’s not optimized to run on mobiles. The better your website looks, feels, and performs across different screen sizes, the more traffic it generates.

3. Engaging Content

Content is truly the king of the digital world!

Nothing can save a website with dull and boring content. Users never revisit a website if they do not like the content there. Websites with interesting articles, impressive info-graphics, catchy images, and meaningful videos definitely receive the highest amount of traffic.

Improved content is also a crucial factor for search engine optimization. The better your content is, the higher it ranks on the search engines. A higher rank on search engine pages leads to higher visibility amongst your target audience.

4. Smooth & Simple Navigation

The audience doesn’t bother using confusing websites. They abandon a website the moment they feel that it’s difficult to move around. In fact, most user complaints are related to navigation issues. This proves the fact that a website’s performance also depends on smooth and simple navigation.

5. Search Engine Optimization

An effective UX Design means better SEO for your website. But how do search engines determine the ranks of the websites? They check the website’s relevance in terms of the user interface, user experience, customer support, and content. If a website performs well in all such aspects, it automatically ranks higher on the result pages. And a better rank on search result pages automatically drives more traffic to the website.

How to Ensure an Effective UX Design?

To provide an exceptional experience to your users, you first need to know them closely. Research about your target audience and develop user profiles. User profiles will help you create experiences that relate to their emotions.

Then experiment with different user interface designs. When you have a few suitable alternatives, test them to see which one is more effective. Tools like Google Optimize allows you to test different interfaces and see which one performs better.

Do not forget to include your users in the design process. Take their feedback to know what they would prefer to see on your website. You can use surveys, interviews, polls, or suggestion boxes to gather valuable user insights.

Make flowcharts of how you expect your users to move around the website development agency. Then compare how they actually navigate through the website. Use tools to track their movement and then make relevant structural changes based on that data.

Finally, think about the sitemaps, style guides, design patterns, wireframes, and prototypes for an effective UX design.

Conclusion

Your website’s traffic highly depends on what the users feel when they use your website. A good UX design is necessary to attract new visitors and convert them into actual customers. More people will use your website if it’s easy to navigate, SEO optimized, and quick to load. Plus, engaging content also plays a vital role in generating more traffic to your website. The better the UX design of your website is, the more traffic it receives.

The post The Key Relation Between UX Design and Website Traffic appeared first on SiteProNews.

Web Designs and Conversion Highlights: 6 Creative Solutions for Your Business

posted on January 25, 2022

tags:

What is web design important? Why should you go for it? Let’s look at several creative solutions you could use to improve your business.

Your business will never feel or look real to you or your audience until you have a website that boldly reflects your brand and values to the world. Most businesses lose out for lack of a better understanding of the importance of web design and how to build a better website for their business.

A good website design sets the first impression, builds brand identity, and, most importantly, credibility of who you are to your audience. For instance, if only given a few minutes to consume certain content, it’s no secret a majority will opt for something beautifully designed rather than something very plain and simple.

Given that website development involves a lot of steps, it’s advisable to work with professionals with relevant expertise and specialization. This is why Irwin from Chromatix said that web design these days needs the right team to handle web development procedures. In his words: “You would not entrust your heart surgery to your GP (general practitioner).”

That being said, we’ll now discuss several web design creative solutions that you could implement on various business strategies.

Creative Web Design Solutions for Your Business

1. Make Use of Solid Navigation

Your audience wants to obtain information quickly and easily. Nobody wants to access your site and find it hard to gain information. To ensure leads remain on your page, you must consider implementing navigation that is easy to use for your audience.

Most visitors’ attention spans are short. Poor navigation will turn them away and further discourage them from engaging on your page. To avoid this, you will need to help them access information more easily and quickly. Having a properly designed navigation will help your audience gain the information they need and ensure leads remain on your page.

You can achieve this by making the navigation simple and self-explanatory. Also, include broad headings that encompass numerous subtopics so that information is easily accessible.

2. Use a Responsive Design

Responsive websites are highly user-friendly. With the growth of the use of mobile devices, we can’t argue about the importance of using responsive designs to grow your business. Your audience will access your site from several devices, including smartphones, tablets, and desktop computers.

You must ensure each person gets to enjoy a positive experience on your website no matter what device they are using. A positive experience means leads remain on your site. And an excellent responsive web design service will help your business stay ahead of the trend.

Therefore, if you want to keep leads engaged on your page for a longer time and have a successful website design, ensure you integrate a responsive design.

3. Use Visual Elements Purposefully

Image courtesy of Pixabay

While visual elements are great for engaging the audience and breaking up text, most businesses lose out by going overboard with the images. This leads to their site being crowded with photos and videos. Ultimately, a cluttered site like this may make a user feel overwhelmed and less likely to interact with it for an extended period of time.

You may think it’s a great idea to go overboard with photos and videos. But in reality, it makes it hard for your audience to read the page. If you want a successful site, consider balancing images and text. Don’t add images just for the sake of increasing engagement. This is not the right way to go about it.

Use visual elements purposefully. If, for instance, you have a block of text detailing your services, you can integrate a video below the text that gives more information about said services. This will create more interest in your audience and lead to more engagement with your page.

Once you know the significance of a good web design, you make more tactful decisions regarding your site.

4. Write a Quality Copy

Your audience will always visit your website to derive information. They expect to obtain helpful information from your site. For this reason, you need to ensure you write a quality copy. A good copy will keep your audience engaged longer and create more interest in what else you might have to share with them about your services/goods.

For consistency, ensure your writing style aligns with your website’s style. The content you put on your site is as essential as the overall design. Hence, you need to provide your audience with valuable information.

5. Check Your Page Speed

Having an excellent web design won’t matter if your audience never gets to see it. Page speed is an essential element to incorporate into your web design. It’s a key factor in ensuring your page loads quickly and that your audience obtains information fast.

If your page takes too much time to load, your audience will lose interest fast and opt for a competitor’s page instead. To monitor your page’s speed, you can rely on page speed services offered by web design companies. This will ensure you reap the advantages of a fast-loading page while you focus on running your business.

6. Have a Style Guide

Apart from forming the basis of your website appearance, a style guide separates you from the competition. It ensures a consistent brand image display across all pages of your website and builds brand recognition in your audience.

Final Thoughts

Your website design plays a significant role in your online marketing success. To make your business stay ahead of the trend and obtain good results, you must consider investing in designing a website that draws people to learn more about your business.

To improve your website experience and transform your business, consider the implementation of some of the creative solutions listed above to create a lasting impression.

The post Web Designs and Conversion Highlights: 6 Creative Solutions for Your Business appeared first on SiteProNews.

Choosing an eCommerce App Template to Supercharge Your Business

posted on January 21, 2022

tags:

This article is designed to help eCommerce store owners who are searching for ways to boost their online presence. Whether you’re brand new to eCommerce or an established professional, you’ll likely have noticed that reaching a wider audience is easier with a mobile app. The number of smartphone users in the United States reached 298 million in 2021, and this number is expected to grow even more. More mobile phones means more mobile shoppers, and by 2024, the number of mobile buyers is expected to be 187.5 million! Looks incredible!

While it’s easy to see why an app would be important for your business, you may not have the 3+ years of iOS or Android development skills to build your own or the budget to hire your own team. Choosing an eCommerce app template will help you bridge the gap.

What Is an App Template?

An app template is a fully-fledged application that already contains the necessary functionality and allows app creators to customize interfaces, adjust the images, and use their own colors, themes, and content. In short, templates help you create a mobile app even if you have no coding skills, saving you time and money.

How Do App Templates Help eCommerce Store Owners Create Apps?

There’s a bit of a glut of app templates on the market which can be quite overwhelming. The good news is that you can find templates created specifically for eCommerce sites. These templates already contain pre-built eCommerce-specific functionality: store navigation, item search, filtering, product descriptions, carts, check-in, check-out, and more. All you have to do is customize the template, and you’ll have a ready-to-go application. It’s easy to edit and customize templates, so your app will look exactly how you want. You can replace banners, adjust visual element colors, apply new color settings, and more — all using step-by-step instructions without a single line of code.

How Do I Create an eCommerce App with an App Template?

Let’s use a Shopify site as an example. We’ll walk you through the steps of creating a mobile app with the Appery.io eCommerce app template. There are only five steps:

  1. Link your store with the app template
  2. See how your site looks on a mobile device before customization
  3. Customize and edit the interfaces
  4. Test your customized app
  5. Export the app to Android or iOS so it can be installed on mobile devices

These steps are quite straightforward, so you’ll have a mobile app in no time.

Choosing an eCommerce App Template

Here are some examples of eCommerce app templates that will help you build your own mobile app:

1. Zappter

This eCommerce app builder contains ready-made eCommerce templates that will help you start developing an app. The process is pretty straightforward as well. After signing up, you have a choice of hundreds of templates. Choose your favorite, modify and customize it, use the suggested plug-ins if you need additional features, and publish your app.

2. Builderfly

Builderfly is a mobile app builder focused on eCommerce, and it offers several popular templates in its marketplace. In addition, when the app is ready, it has a feature to track user behavior by tracking activity in real time and sending relevant offers with discounts or ads.

3) Appery.io

Appery.io offers a template for Shopify users. The template syncs the Shopify website catalog with a newly built mobile application and provides codeless customization; you can change color settings, replace banners, adjust elements, and more. It also allows you to preview the application before publishing it on the App Store or Google Play.

4. Instappy

With Instappy, you can create your eCommerce app for iOS or Android by choosing one of the numerous app templates from their “Themes” section. In their Shopping and M-Store category, you will find templates for food & beverages, furniture, clothing & accessories, books, shoes, and other types of eCommerce stores.

5. ConstApps

ConstApps integrates with WooCommerce, Shopify, and Magento and contains a number of ready-made themes that you can use as a template for your mobile app. You have the option to choose a default theme or choose a specific “clothes store” theme or a “restaurant” theme.

Have you tried one of the solutions listed above? If yes, please feel free to share your experience and also name the app you’ve tested.

Useful Tips for Choosing an eCommerce App Template

Here are some tips that will help you choose an eCommerce app template for your store:

  1. You’ll almost always get a fully-developed app with an eCommerce app template, but keep an eye out for extra plug-ins if you want to add more integrations or functionality.
  2. Make sure that the platform you choose offers documentation with an explanation of how things work. As mentioned above, the steps can be easy and straightforward, but step-by-step guides with instructions never hurt.
  3. See whether or not you will have complete ownership of your new mobile app created with the help of an eCommerce app template.

Conclusion

If you want to boost your eCommerce business’s conversion and sales, don’t forget that a significant number of your customers may be spending most of their time on mobile phones. Consider eCommerce app templates to build your first mobile app and supercharge your business.

The post Choosing an eCommerce App Template to Supercharge Your Business appeared first on SiteProNews.

4 Effective UI Improvements to Skyrocket Website Conversions

posted on November 26, 2021

tags:

One of the most significant barriers for websites to get conversions is the website itself, precisely due to the User Interface (UI) and UX (User Experience).

Today, there are many ways to build a unique website without spending too much time or resources. These easy tweaks will help boost user experience and boost the website’s conversion rates.

Note: there is not a one-size-fits-all solution for improving UI. As we move into an increasingly connected world that has seen the most significant shift to online since WWW was introduced- it is now even more crowded and competitive.

Image courtesy of <a href=”https://www.broadbandsearch.net/blog/internet-statistics”>Broadband Search</a>

Getting in front of consumers ahead of your competitors has never been easy. And now, thanks to social media platforms like Instagram, Facebook, Snapchat and Pinterest, social and online presence have become one of the most vital parts of a business today.

What is UI?

The user interface is the website’s design that supports the user’s experience (UX) when browsing. Therefore, almost all website elements, including buttons, search bars, CTAs, icons, and text layout, can be considered UI design elements.

Researching and refining how your users interact with your site is a great place to start to boost conversions and generate more leads. User experience ensures users find valuable services and products on your site as efficiently as possible.

For all businesses, one of the main aims is to generate more sales. More sales equate to steady growth and better financial outcome. UI, along with UX, plays a vital role in this growth.

There are some fundamental components of UI that make for a more effective website when placed together.

The site’s usability and its visual design and interaction design affect users’ interpretations and use of a site. Therefore, the site’s information architecture is vital as it ensures users can access the information they need.

Wireframing is an integral part of UI. It is a visual guide representing the site’s design framework, outlining how buttons, tabs, and menus respond to users’ actions. It helps to make sure users can easily navigate throughout the website.

When building a substantial brand value and reputation, businesses must emphasise a high level of user satisfaction across all areas, including the website. As e-commerce continues to grow, online shoppers have higher expectations when it comes to the online experience. Therefore, online stores opt to push to satisfy the needs of their customers as the top priority.

A representation of the steady growth of e-commerce from 2000 to 2020 with a significant increase toward the end thanks to the Covid-19 pandemic: Statista

The need for a brand to get its online presence and site right has never been more critical than now. In addition, a well researched and thorough UI can effectively grab consumer attention and enhance user experience, thereby improving ROI.

UI Design Elements

UI elements of a website consist of parts and elements that designers use to improve the development of apps and websites.

An online study found that improving a site’s navigation may help increase the conversion rate by as much as 18.5%. Therefore, all websites must pay attention to the UI and UX. Here is a look at four practical ways to improve UI:

1. Improve conversion with persuasive CTA

A highly effective call-to-action (CTA) button does what it says on the tin and helps to deliver a direct yet straightforward statement for the user. In addition, it gives clear directions to the user concerning what to do next, and upon clicking the button, it provides the users with the idea that they are visiting a different website.

With great design and UI that is simple yet catchy, CTAs are crucial as they guide consumers into the sales funnel where conversions happen.

Image courtesy of GoSquared

With a focus on mobile users, presenting a large area responsive to a tap or a click on a call-to-action button is essential to leading the user to the right destination.

Unfortunately, many buttons on a website are purely graphical and embed small link texts, which work well for viewing sites on a desktop but are not very mobile-friendly. Designs like this can cause frustration to users and deter them from using a website altogether.

Also, we advise you to use a standard colour of red for each type of call-to-action button. If your website visitors get used to a particular colour for a specific button, they will subconsciously be more attached to it.

When designing a template, make sure to pick the right colours for each type of CTA button. If a call-to-action button is too small and not clickable, chances are there will be fewer clicks, and conversion rates can drop significantly. Make sure that all-important links incorporated into the button are identified quickly and have a correct anchor.

Tip: Do not play around with button colours too much. If your “Get Started†button is colour blue, try keeping everything consistent (i.e. avoid using a different colour for the same button on a separate page) – this may confuse the user.

2. Use white spaces effectively

The first step in improving conversion rates is to pay attention to the psychology of colour.

Make it the goal to remove all excess clutter and noise from a page. Then, replace the white space with the images that matter. Adding a background image to one page is possible, but it is essential to ensure it doesn’t distract users from the aspects you want them to see.

White spaces allow users to scan the website smoothly without being too distracted by any clutter or unnecessary elements on the page. White areas are a great way to increase click-through rates. For this reason, keeping an adequate amount of white space on a page can lead to more leads and a higher conversion rate.

Furthermore, white spacing makes information on the page look more clear and defined.

The use of white space on Apple’s website promoting latest handset

However, using colour in the right way can be tactical leverage for any business with this in mind. Using colours is effective to help focus the user’s attention to specific parts of the page and work well for actionable elements such as CTAs.

Tip: Using warmer tones like orange and yellow attracts the eyes the same way red does, expanding against darker, colder tone colours such as blue and green. Highlighting these crucial elements of the page ensures they do not get lost.

3. Link padding

Anchors and links present on the site by default are usually the same size, keeping in line with the rest of the elements on the page. Unfortunately, this means they can only span that specific area to remain clickable, such as the height and width of the text.

Expand the clickable area for superb usability of the link. Adding extra padding to the text can also be done by converting the link into a block element, making it appear more extensive and inviting.

You can use the following simple code to increase the padding of the link:

a {
display: block;
padding: 6px;
}

A larger area will, for obvious reasons, be more clickable and easier to use. This method also makes these links more mobile-friendly, giving users less chance of missing the link. Converting links into blocks also helps make the text area span the entire width of the box, making the theme ideal for sidebars.

Adding a healthy amount of padding to the link is essential as it ensures the link itself is visible enough to be clicked.

Tip: Do not overuse padding on text links (i.e. links that are not buttons). These may confuse and frustrate mobile users when scrolling down. Users can accidentally click the link without intending to do so.

4. Design based on users

Sometimes it is easy to get carried away with designing your new website. However, it’s increasingly important to offer your user what they want compared to what your business thinks they might like. Thinking about the consumer, what they need, and the types of things they would look for will help construct a better, well-thought-out website tailored to users’ needs.

A timeline indicating progress on the site is one of the best UI elements to include on a site. The timeline helps users understand where they are in the sales funnel and essentially helps them in and out sooner.

Use tools like Google Analytics and Finteza to determine the pages your users stay on, how they go from page to page and where they drop off.

Unfortunately, design elements are of much concern to users. Yes, they help make sites look attractive. Still, the baseline is that consumers want to get things done in the shortest amount of time with the least amount of hassle and frustration. A good design will have all these elements integrated. In addition, the easier the sales process can be, the more inviting it is for users, giving them a positive shopping experience and making them more likely to come back.

Tip: Use heatmaps to determine the website areas where your users seem to be focusing most. Determine the areas that need tweaking, then use them to display the most important CTAs.

One of the main points to consider when creating and having a website is that it needs to constantly be updated to work best for those interacting with it. Make sure to run tests and audits, helping you keep on top of the competition.

The post 4 Effective UI Improvements to Skyrocket Website Conversions appeared first on SiteProNews.

How to Create a Website that Wows

posted on September 10, 2021

tags:

In today’s digital world, creating a website that stands out is a must for any brand. No matter what type of business or industry you are in, there is likely some steep competition on the internet. Making your website one that wows visitors and keeps them around is pivotal to your online success. 

So how do you create a website that truly captures the attention of web browsers? Thinking outside the box and adding unique features are sure to get you noticed. However, it’s important to stay true to your brand and its image and personality. So, here’s some strategies to create a site that wows browsers while still being authentic to your brand. 

Make it Fast and Functional

The first impression that users get from your site will likely be how quickly it loads on their device. In fact, 53% of customers will simply leave a site if it takes more than three seconds to load. Plus, the loading speed is a factor in Google’s search engine algorithms and a faster site can earn you a high spot in search results. 

Make your loading speed a priority to be sure users will stick around long enough to see just how awesome your web page is. Test and troubleshoot your load times regularly. Then look for ways to make it as quick as possible. Everything from compressing your files to evaluating your server type can make a big difference in load time. 

The other component of making a great first impression is ensuring that your site is fully functional on all devices. Mobile browsing makes up 54.8% of web traffic. Not having a mobile-friendly site could mean that you’ll miss the boat on all of those potential visitors. Make sure your site is easy to navigate on touch screens and loads quickly on mobile devices as well.

Create an Interactive Experience

One trend taking the online world by storm is gamification. This technique creates a more engaging and interactive experience that can draw web surfers in and keep them coming back. And the best part is that it can be incorporated into every website, no matter the type of brand. 

Gamification creates a competitive vibe that appeals to many consumers. Creating special badges for those that leave the most frequent reviews or tiers based on purchase history gives customers something to strive for. With this technique, they are enticed to achieve higher levels by returning to your site again and again.

You can also use gamification as a fun way to provide discounts and share promotions. Who doesn’t love spinning a virtual wheel to reveal the percentage off they’ve earned? The most important part of gamification is ensuring it’s enjoyable to the user, adds value to your site, and that the features work well across all devices.

Customization is Key

Image Source

Your users want a personalized experience when they visit your site. This is true whether you are selling goods or a service. Being able to feel that your site works to meet their unique needs will make it stand out from the crowd. 

Online shopping is a great tool, but many shoppers miss the trying before buying aspect of in-person shopping. If you are selling things like clothing or accessories, add a tool to your site where visitors can upload a photo and “try on†your inventory. For home goods sites, features that allow shoppers to add images of their own spaces and see how your items look in them can be a big win. 

“Build Your Own†type tools are another way to provide visitors with a customized experience. If you are selling food or drinks, allow users to craft their own meals or beverages virtually. Include nutritional info as an added bonus. If you see custom products, make sure customers can customize everything from color to size with the touch of a button. They will be more confident that the one-of-a-kind item they are buying will be exactly what they are envisioning.

Get Visual

A whopping 65 percent of people are visual learners. So while you want to communicate plenty of information via text on your website, visuals are what will likely get you noticed. Your graphics have the potential to make or break the whole feel and vibe that your web pages create.

Make sure you use relevant, high-quality graphics that align with your brand. Product images should be clear and taken from multiple angles. Moveable, 360-degree images are even better. It’s important that customers can really get a feel for what products look like in person from your photos. 

The vast majority of websites and brands can use infographics to their advantage. Create one that shows the steps of using your product in new and unique ways. Use catchy images to create an infographic full of statistics regarding your service’s industry. Infographics are great tools to add value to your website in an appealing and easy to interpret way. 

Create Valuable Content

One way to make your website wow users is to provide useful information to them with no obligation. This shows that you care about your visitors getting something out of your website. It will also keep them returning in the future to see the new and exciting content that you have to offer. 

Blogs have stood the test of time in content marketing and for good reason. They are customizable, fairly easy to implement, and can work for nearly every website. Post to your blog regularly and create a clear tone and personality. Drive kitchen enthusiasts to your cooking site with weekly recipes. Or, blog about the latest fashion trends on your retail site. Making the blog relevant to your brand and useful to visitors will encourage them to return again and again.

Videos are a powerful tool to take advantage of for your website. Product demos are a great way to familiarize visitors with features and usage tips. A fun video can even be used to set the mood. Seasonal shorts, holiday ads, and mini-music videos are all awesome ways to appeal to all of the senses and make your site stand out. 

Making a Memorable Website

Image Source

Internet users are fickle and there are plenty of choices out there to distract them from your site. Make sure it’s memorable, innovative, and speaks in a unique way for your brand to keep them sticking around. And it’ll pay off in longer browsing times, return visits, and a growing and loyal customer base that’s around for the long run.

The post How to Create a Website that Wows appeared first on SiteProNews.

Custom Web Design vs Website Templates: Which One to Choose?

posted on September 9, 2021

tags:

Going online is proven to be a key advantage in today’s competitive business world. What’s more, customers carry out in-depth online research on online products or services and spend more time on beautifully designed sites before making any purchase decision. Not only do they check out websites, but they also interact with them longer if they are well designed and aesthetically pleasing. Moreover, customers form their opinion as to your business and make a snap judgment whether your company is credible or not. According to statistics, 48% of people considered a website’s design as the deciding factor in the business credibility as well as 94% of surveyed mentioned that they rejected a website if their attention didn’t begin to wander. Only by leaving a positive effect on your audience can you keep it engaged for a long time. That’s why you should design a visually appealing, user-friendly and highly responsive web solution with a focus on fast loading. This will give your prospects an enjoyable experience, help maintain them on your page longer and effectively increase conversion rates. However, when it comes to website design, you need to decide whether to turn to a custom web design or a website template. Let’s get started to discover the difference!

Website Design: Why It Matters

Let’s reveal why you should care about your website design:

  • A website design conveys your business’ first impression and drives potential customers to your online business.
  • Professional web design tends to promote trust, builds brand recognition and helps the target audience easily identify your brand among competitors.
  • A visually appealing website design that users are likely to use significantly increases conversion rates and keeps customers engaged.
  • An easy-to-use nature of website design reduces bounce rates.
  • Investing in an up-to-date and eye-catching website design allows you to improve customer service, increase customer loyalty and satisfaction levels.
  • With a sophisticated SEO-friendly website, you can drive organic traffic to your website and enhance your online presence.
  • Not only does eye-catching website design attract more customers, but it also sets your business apart from the rest and helps fight off them.

What Is Exactly Custom Web Design?

Generally, a custom web design is tailored to your brand’s unique identity and positioning. Not only does it start from scratch, but it is also specifically created to reach out to your target audience and align with the marketing strategy. Moreover, it can be configured to grow with your business into the future.

What Are the Pros and Cons of Custom Web Design?

Here we are going to overview some advantages and disadvantages of using a custom web design:

Custom Web Design:  Its AdvantagesCustom Web Design:  Its Disadvantages
It is unique and meets your branding needsIt takes more time to deliver a working solution
Works across all browsersIt needs additional support in terms of business growth
Provides integration possibilitiesIt is more expensive
Delivers built-in SEO feature
Keeps code up-to-date
Provides better security and control

Unlike a template-based website, opting for custom web design allows you to deliver flexible and manageable, scalable and SEO-friendly digital products that are unique and highly responsive. However, it requires more money to be invested and development time to be spent.

What Is Exactly a Website Template?

Basically, a website template is a ready-made design that needs to be filled with content such as text, images, and media to become a full-fledged website. Moreover, a website template includes all the essential features of a regular site. Only by choosing a theme’s type and purpose can you install a website template and make customization with a simple click. However, website templates have limited functionality and don’t provide scalability in terms of business growth. Let’s discover some popular components of the web templates:

  • Professionally designed logo
  • Header, footer, navigation
  • Picture galleries
  • Mobile-responsive layout with predefined content blocks
  • Animations
  • Ecommerce functionality and stock content
  • Additional features (e.g., booking functionality, calendars, real estate listings, etc.)
  • Contact forms

What Are the Pros and Cons of Website Templates?

Let’s look at the advantages and disadvantages a template-based website can offer for your business.

Website Template: Its AdvantagesWebsite Template: Its Disadvantages
Less expensiveProduced for the mass market, it is not unique and exclusive as other businesses may use the same template
Any person can design a website through drag-and-drop tools to  add/remove web elementsLimited customization possibilities
Provides affordable pricing for hostingThe poor support and browser compatibility
Cuts the development timeInconsistent user experience across different devices  
Minimizes the launch time of your online projects

As you see, you don’t need to be a coding whiz to add or remove the components of the website template. Moreover, if you have a tight budget and want it to be launched fast, a website template is an attractive option for you.

Custom vs Template Websites: Key Factors to Take into Consideration

If you want your online business to succeed and grow worldwide in the near future, deciding between custom web design and a template-based one is critical. In most cases, the primary factors are the budget and development time. However, there are other factors you should consider when making a decision between the two:

  • Goals: Only by identifying business needs, the purpose of the site, key features and functionality can you go in the right direction.
  • Budget: Being in line with your budget eliminates the discrepancy between what you expect and what’s actually delivered. Moreover, knowing the web design prices gives you a more realistic outlook for budgeting.
  • Niche and competition: Only by carrying out competitive analyses can you efficiently identify competitors in your business vertical, their sorts of websites, effective campaigns, etc. This will help you determine how to make your website better and crush the competition.
  • Potential customers: Only by identifying your typical customers can you select the kind of website your business needs and tailor your web solution accordingly.
  • Development time: Designing a custom web solution takes more time while web templates are less time-sensitive. However, a web template is an attractive option if you need to develop a proof of concept before switching to a more full-fledged website.

Bottom Line: Opt For Website Template or Custom Website Design?

Website design can make or break your business. Whether you are trying to stand out from the crowd, choosing between template-based or custom web designs is a necessity. However, there’s no one right choice for every digital product. Only by identifying your business needs and personal preferences can you make a decision between a custom website design and template-based website. Custom web design is always the way out for those businesses that aren’t limited by budget and development time. Not only is it fully customizable and unique, but it also gives you complete control.

As for a template-based website, it cannot fully adjust to your business needs and comes with too many limitations on brand expression, functionality, security and scalability — this will cost you more down the line. In addition to that, you should probably decide in favor of a website template without having a technical background or related experience. That’s why you need to concentrate on your specific business requirements and resources at hand, evaluate the pros and cons and decide what is best for your business. Only by having a website that expresses the cohesive company identity can you grab the attention of your potential customers, increase customer base and drive more revenue.

The post Custom Web Design vs Website Templates: Which One to Choose? appeared first on SiteProNews.

6 Major SEO Factors to Consider in Web Design

posted on August 20, 2021

tags:

Search Engine Optimisation is important for businesses that want to operate online. Many of us have this notion that SEO is something that is to be “added later” after creating the website. However, SEO is something that needs to be built-in while designing your website. After all, it is your website that showcases the first impression of your business on users and search engines. But this first impression is not just about how your website looks but also about how optimised it is. This article shares 6 major SEO factors to consider in web design

1. Mobile-friendly design 

We live in a mobile-first age. No matter whether we are searching for a restaurant or a local store, we browse websites with our mobile phones first. According to Oberlo, 53% of people who shop online every day rely on their smartphones. Therefore, the first factor to consider in web design is mobile friendliness.

To create a mobile-friendly design, you must consider the needs of your user. The way users interact or want to interact with a website on their mobile phone is quite different from how they interact with a website through a desktop or any other device. 

Moreover, Google has also been considering mobile-friendliness an important factor for SEO. So, creating a mobile-friendly website will not only provide a better user experience but will also enhance your search engine rankings. 

2. Usability of the website 

By “usability” we mean how easy it is to use your website – whether a user can perform various tasks on your website such as navigation, signup, placing an order et cetera without getting confused and whether first-time users can understand the purpose of your website easily.

Usability directly affects the SEO of a website. If a website is difficult to navigate, users will abandon it quickly. Also, it will prevent them from returning to your website. Your website must be designed in a way that satisfies their search and provides them with what they are looking for. Google understands that well before users while indexing a website and hence would never rank an “inefficient” website on the search engine. 

3. Content of the website 

Where you place your content and what kind of content you place on your website, all these things matter a lot in your search engine rankings. No matter how clear the layout of your website is, if the content is not eye-catching and valuable, users might not be interested in your service/product. Here are different types of content you need to present on your website for better SEO: 

  • Content that brings awareness: Blogs, informational posts, webinars, FAQs and guides
  • Content that helps users understand why you are the best: Case studies, product information, user guides, video tutorials 
  • Content that drives conversations: Testimonials, reviews, free consultation, free service 

John, who offers dissertation help in business management to college students says, “creating content for your website that caters to bringing awareness, driving conversations and showcasing your purpose will not only make your website easy to understand for your customers but will straightforwardly solve most of their queries. In all, enhancing your search engine rankings.”

4. Choose text over images 

Images make things easier. They are attractive and allow users to understand and remember your website. But, search engines appreciate text over images when it comes to ranking a website. If you add any important information about your website in the form of animation, videos, images, graphics or JavaScript, it is likely to be ignored by search engines. Therefore it is recommended that all key information should be added as HTML code rather than an image. 

But, how do you enhance your website if you do not add images? 

You can add supplemental information like caption, transcript and metadata to help search engines determine the value of the content and hence drive more traffic to your website. Always provide alternate text or descriptions for images. You can also add OpenGraph and Twitter Cards, so the images can be used in social shares.

5. File optimisation 

Not only alternative text is required for all your images, but the name of your image files or any other media files also matters. For instance, instead of leaving the file names as IMG001.jpg, IMG002.jpg etc, you can use more contextual names like Web_vital_Statistics.jpg. etc. This will help search engines understand the context of your images. 

Similarly, you should choose to upload small file sizes and thus contribute to site optimisation. Large files can slow down your website thereby increasing bounce rates and poor user experience. This can drop your search engine rankings. Samantha, who works as an SEO expert for online dissertation writing services says, “if you are using large-sized files and videos, you can choose lazy-loading, where necessary information or pages are loaded first to enhance the user experience and decrease the site’s bounce rates.” 

6. Enhance website navigation 

Do you know that website navigation is important for SEO? In fact, search engines crawl and know more about your website through website navigation. Steve, who offers onlinedissertation proposal help in e-commerce says, “if you have designed a well-structured website that can take the search engine crawlers to the most important pages of your website, it can help enhance the authority of your website.”

Conversely, if your website has no proper navigation system or it is overcrowded with too much information scattered all over the website, search engine crawlers will not be able to identify the important pages of your website. 

Steve has many dissertation examplesthat showcase that a website’s navigation structure also enables users to find the information they are looking for. In all, it enhances the search engine ranking of the website. 

Wrapping up 

SEO should be your priority while designing your website. Create a mobile-friendly design and work upon enhancing the user experience as much as you can. File optimization also plays a major role in enhancing the SEO of a website. Prioritise uploading smaller files, keep contextual names of all your files and use lazy-loading. Always provide descriptions for the images that you upload and ensure that your website has smooth navigation. Hope these 6 tips will help you design a search engine-friendly website that not only impresses many users but also the search engines! 

The post 6 Major SEO Factors to Consider in Web Design appeared first on SiteProNews.

4 Points of Failure in B2B E-Commerce

posted on August 14, 2021

tags:

B2B e-Commerce market is on the rise these days. Due to innovation in digital marketing and e-commerce, more companies are looking for B2B business solutions so that they can easily interact and trade with big businesses. B2B e-commerce allows companies to reach businesses around the globe in no time. Cloud-based e-Commerce makes inventory and order processing a smooth task. Businesses can not only find new customers but also retain clients for longer prospects. 

But, that is all the bright side! 

Another side of the coin is that not many B2B e-Commerce businesses are able to survive and they fail quickly. What could be the reasons? In this article, I am sharing 4 points of failure in B2B e-Commerce. Start noticing these red flags from the beginning so that you can leverage all the benefits that this industry has to offer.

1. You do not have a well-designed website 

Many businesses think that well-designed, organised and structured websites are for individual customers and not for businesses. This is why they do not pay much attention to creating an eye-catching website for B2B e-commerce. However, this is a bad practice and can easily lead to the failure of your business. Here are a few ways how you can ensure a well-designed website: 

  • Just like B2C customers, B2B customers are looking for websites that can be navigated easily. So make sure your website has optimised navigation
  • B2B customers expect a clear, concise and smooth checkout process
  • Branding and reputation are equally important in B2B businesses just like B2C businesses 
  • B2B websites must include CTA’s (a lot of them!) because without them it might be difficult to attract the customers 
  • An estimated pricing calculator will spruce the website up and will make buying much easier for B2B customers

If your website is nothing like this, it is time to revamp it and turn your steering towards success. 

2. You are not building a social media presence

We all know that people nowadays devote more time and energy to social media. They not only use it to communicate with their friends and family but also to give their opinions on topics and say how they are feeling. So if you think that being a B2B e-Commerce business, you do not need a social media presence, you must think twice! Here’s how social media can prevent your B2B e-Commerce from failure: 

  • You can use social media as a marketing tool and release important information to your customers 
  • You can use social media as a sales tool and find potential buyers and new leads
  • You can use social media as a feedback and support system where you can seek feedback from your customers and also provide them with customer support whenever required 
  • You can use features like storytelling to engage with your audience and build a reputation for your brand 

By not using social media properly, your B2B e-Commerce business is missing out on many things. 

3. Not providing sufficient product data to customers

B2B e-Commerce is all about product information. You must provide your customers with all the necessary information about a product so that they can make a purchase. Only the product name and price will not be enough as other competitors will be providing the same. If you want your B2B e-Commerce to succeed, you have to think beyond the syndicated content provided by manufacturers. Here are a few ways by which you can set yourself apart: 

  • Add a variety of product images such as 360-degree interactive images, specification tables and specification calculators 
  • Include information such as installation guides, warranty information, and additional safety information for your customers
  • Provide clear and detailed product descriptions and promote transparency 
  • Include product videos, tutorials or demonstrations to engage customers with your products  

Do not assume that your customer already knows about a product. Even if they do know, reading all the information on your website can help them make a clear choice. 

4. Not giving much importance to user experience 

Many B2B business owners have this notion that they do not need to please the customer or provide a great user experience. This could be a reason for the downfall of their B2B e-Commerce business. You must be able to convince customers that you are providing them with a high-quality product and doing business with you will bring them long-term benefits. Your product will not only benefit them but also their customers. Here are a few ways to make it possible: 

  • Use the power of storytelling to engage your audience (it could be a short video, a testimonial or infographic) 
  • Add a live chat option on your website enabling customers to get quick answers to their queries 
  • Allow your customers to talk to any of your account managers who can provide them with personalised guidance while they buy a product 
  • Optimise site navigation, search, check out, listing pages and shopping cart to meet the latest standards of buyers 

Treat your clients as people, not businesses. When decision-makers buy something for their business, they think like people buying things for themselves. They have the same expectations and questions in their minds. 

Wrapping up

Did you notice any of these red flags in your B2B e-Commerce business? If yes, then it is time to make things right and run your e-Commerce business the correct way! Just remember that your website must be well-designed, organised and optimised for customers. Include a variety of CTA’s on your website. Work on building a social media presence because that is the best way to stay connected with your customers and find new leads. 

Make sure that you are providing enough information about your products on your website that sets you apart from your competitors. Lastly, treat your customers as people and not just any other business. Take care of their expectations and provide them with a seamless user experience. Follow these tips and in no time, your B2B e-Commerce business will experience great success! 

The post 4 Points of Failure in B2B E-Commerce appeared first on SiteProNews.

Tips for Improving User Experience on Your Website

posted on August 4, 2021

tags:

Your website is arguably the most powerful marketing tool in your arsenal, a source that regularly and consistently markets your brand around the clock. With such an essential tool at your disposal, it is an obvious choice to center your marketing efforts around it. 

Usually, the first interaction a prospective customer has with a business is with their website. The time-old adage of “The first impression is the last impression” holds true in this case. Your website can either leave the visitor with a good impression or a wrong lasting impression. 

Whenever we develop a product, one of the fundamentals that we keep in mind is the user experience. Nowadays, basing the product design around the user experience is all the more important, as even a slight issue might cause the customer to abandon the product. 

While logic dictates that user experience is an essential aspect of web design, some designers tend to ignore this. The result is a product, despite being designed well, does not attract customers. 

Now, user experience or UX changes over time. This can result in a product that looks out of touch or old-fashioned. To remedy that, we have curated a few essential tips to improve your user experience for the long term. 

But before that. Let’s look at what UX is and why it is essential to the design of your website.

User Experience Design – What is it?

User experience design, or UX design, is the process that helps us improve the user experience of our website’s visitors by:

  • Making the interactions on our website more straightforward and more intuitive, thus improving usability.
  • Making sure that all sections of our website, which are designed to convert, are easily accessible.
  • Designing the visitor interactions so that they are as efficient and straightforward as possible, reducing the chances of them getting frustrated and leaving. 

In short, it helps us design the website so that it is as easy and intuitive to use as possible so that even the most amateur user can use our website without confusion. Users today are exposed to several types of websites on the internet, from single page sites to elaborate e-commerce websites and media libraries. That has made UX design all the more essential to ensure that you retain the maximum number of visitors. 

The purpose of implementing UX design is that it helps us smooth out the customer’s experience when using our product. 

That product can be:

  • An actual physical product we develop,
  • A service we provide,
  • The digital content we produce.

Anything we produce or develop that allows someone to interact with it can benefit from UX design.

How does UX design work?

UX design works a little differently, depending on the type of product in question. The product can be either a physical offering or a digital one. 

  • If the product in question is a physical one, the purpose of implementing UX design is to create a product that fulfills the customer’s needs at that moment. In case the needs of the user change, the product needs to be redesigned to cater to those new needs. 
  • For a digital offering, a website design, for example, UX design, can create a flow that directs the user through the various elements of your website that you want them to see. This allows us to influence the viewers by showing them exactly what we want them to see and interact with. 

For both of these scenarios, the purpose is to provide a pleasant experience to the user, whether it is to fulfill their need or ours. 

UI, UX, and how they relate

Many people believe that User Interface or UI and User Experience or UX are the same things. That is because UX design incorporates UI design into it and a variety of other processes. 

This means that UI design is just one UX design aspect, whereas a UX designer is involved during the entire product cycle. Their collaborations include:

  • Product development,
  • Branding strategies,
  • Finalizing the functional features of the product,
  • Its ease of usability.

These are just some of the tasks that require a UX designer’s involvement to deliver a quality product. 

A UX designer is brought on board for branding and marketing tasks to provide a great user experience across the entire process.

Tech companies such as Apple or luxury automobile companies such as Rolls Royce have impeccable user experience, but not just when their product is used. They also factor in:

  • Acquiring their product, such as ordering a new Rolls Royce or the new iPhone,
  • The After Sales services are designed to provide a sense of luxury and uniqueness. 

While both companies have intense competition, their focus on creating such an exceptional customer experience is what makes them successful and unique. 

The examples of Apple and Rolls Royce show that a UX designer does not just make the product flow smooth but also aims to make it an experience full of pleasure. 

How to improve the UX of your website?

Let’s look at how you might begin improving the user experience of your website. 

1. Simplicity is your friend

In terms of website design, simplicity means removing all design elements not relevant to that site’s functions. 

Considering that you want your user to interact with your site in a specific way, any visual component that distracts or delays them from their task should be removed. Users who cannot find the information they are looking for quickly won’t be revisiting your site. 

The guidelines for a simple, clean, and useful web page are:

  • Start with a clean and straightforward layout,
  • A simple color scheme consisting of no more than two or three colors,
  • Use white space wherever needed,
  • No more than two fonts, ideally belonging to the same font family,
  • Use graphics and animation sparingly, and only if they serve a purpose.

The hallmarks of a simple yet effective webpage are:

  • Each web page should fulfill a singular goal. The Contact Us page should contain elements relevant to contact the company and nothing else. 
  • Relevant information should be placed front and center. Any additional or unrelated content should be relegated to the bottom of the page not to distract the user.
  • It should be easy to understand the intent of each page. The content on each page should be distinct enough on its own that a user might easily understand the purpose of each webpage at a glance. 

2. Focus on Consistency

Consistency is a critical factor when designing any product with user experience as a priority. Consistency in design, consistent use of colors and fonts, consistency in page layouts, and much more are factors designers need to factor in when creating a website design. 

One of the most critical factors affecting the user experience is consistency in your website’s design flow. The design flow is the journey a user takes from one related element to the other to fulfill a task. 

If the design flow is consistent throughout your website, users will have no difficulty interacting with your websites and will become repeat visitors. 

But to create a seamless flow, you need to figure out what steps a prospective user might take on your website and then design accordingly. This seamless flow is possible when:

  • You plan your website so that starting from the landing page or blog, the user is guided page by page, leading to the final point of interaction. This will allow the user to go through all relevant information seamlessly. 
  • You eliminate dead-end pages. Dead-end pages are those that do not lead anywhere, effectively ending the user’s journey. Make sure that each page of your website leads somewhere related.
  • Interactions are placed strategically near areas where a user might be inclined or motivated to click them throughout the user’s journey.

The point of consistency is to provide a smooth journey to the user, which can be achieved relatively quickly for a better user experience. 

3. Optimize for mobile devices

As of 2021, mobile devices account for over half of the web traffic globally, according to Statcounter. These include mobile phones and tablets, which show the importance of optimizing your websites for various screen sizes and orientations.

Similarly, search engines love a mobile-optimized site too. 

Google crawls both versions of your website before indexing it, allowing mobile-friendly websites optimized for search engines to score better. 

You can optimize your site for mobile devices by:

  • Designing the layout with buttons centered on the lower half of the screen allowing for easier access by the user’s thumbs. 
  • Optimizing the content so that the relevant information is still prominently displayed when viewed on mobile devices.
  • Group related interactions in such a way as to allow for quick and easy touch access.

Since most mobile users prefer to use one hand, implementing these tips in your website design will significantly improve the user experience.

4. Reduce load times

The time it takes to load all the elements on your web page is significant when improving the user experience. Google recommends a page load time of under 3 seconds for mobile or desktop. Any longer, and websites lose over half of their viewers. 

If you allow for simplicity in your website, it will go a long way to reduce your load times. This will allow your visitors to interact freely without waiting for unrelated animations and graphics to load up, thus improving your site’s user experience. 

A good UX design manages to balance the needs of the users and your website. 

To sum it all up, a website with an exceptional user experience can guide users to the information they desire quickly and smoothly and eliminates everything that might hinder them. 

While it might seem simple to do in theory, it is a little tricky to achieve in reality.

In today’s cutthroat market, focusing on user experience can be a great way to stand out in a positive light. Using these tips, you can start on your journey to provide better user-site interactions.

The post Tips for Improving User Experience on Your Website appeared first on SiteProNews.

Building a Successful Website

posted on July 29, 2021

tags:

The website for your company, business, and brand is commonly going to be people’s first impression of you. With a smartphone in the hands of most of the world, it is more than likely people are going to know you exist because of the internet. Your website becomes the “spokesperson” for your brand. It is so important that it is something that needs to be well thought out and planned.

Building a successful website is a science and an art all rolled into one. There is a lot that needs to be considered and included in your website to make sure that it helps to bolster your success. The proper research is required during your process of creating your online presence. One helpful way to gather your thoughts and refocus your design goals can be to look at website inspiration in order to collect ideas. From artistic to technical, every piece of your website needs to serve a purpose.

5 Important Features of Your Website

Information about web development is easily accessible and out there for the taking. Because of the importance of a company’s website, people have done research to figure out what succeeds to draw in clients. For instance, Marketing Insider Group put out a great blog post about the most important things to include in a website.

Here are five important features your website must have:

The Name

The name of your website is the thing that people are going to remember. This is going to be what they share with their friends when they tell them to go and see what you have to offer. It needs to be short, sweet, memorable, and to the point.

It has also been shown that domain names that end in .com are more successful than those that end in .co, .net, or .org.

All the Necessary Contact Info

You have probably come across those websites whose contact information seems sketchy or is hard to find. This is a major red flag. Clients, and potential clients, want to know that they can contact you whenever they need to.

Contact information may be more than just phone number, email, and address. It can also include all of your social media accounts and the hours of operation for your brick-and-mortar locations.

Easy to Use

Responsiveness and navigability are important features for users. People are creatures of instant gratification, and they want to be able to find what they need and find it quickly. They want to be able to locate the navigation bar at the top of the page, find the page they need and want that page to load quickly.

Part of this is also making sure that your website is also mobile-friendly because so many people are using their tablets and smartphones to do everything.

Content, Content, Content

Anyone who has done any sort of business on the internet has heard the saying, “Content is king.” The content on your site needs to be informative and on-point. According to Marketing Insider Group, “Google favors pages with longer content that shows you as an expert in your field.”

Infographics and great visuals are important too. These images can stick with people. You will also want to make sure that the images are as small as possible so that your site loads as quickly as possible.

Customer Reviews

Before the internet, word of mouth was the most important form of advertisement. Customer reviews and testimonials are the new age forms of word of mouth. These help to gain the trust of a potential client. They show that you are legit and can generate satisfied, happy customers.

Remember, issues and mistakes are bound to arise. It is a show of honesty to allow customers to testify to how you dealt with and corrected an issue they had.

Website Inspiration

Now that you understand what features your website needs, it is time to go out and find your inspiration. Whether it is found by checking out different web design templates or sites that have already launched, looking for inspiration is a great way to see what is working for other successful sites. Try to look for successful sites within a similar category as your brand’s niche. This way you can see what is working for other businesses like yours and possibly implement this strategy.

Being successful on the internet will require some work and research, but it is something that anyone can do. If you understand what it is that you need to do, you can make it happen. The most important thing that you can do is to make sure that your website represents your business and what you are all about.

Remember, first impressions are so important, and you only get one chance at them. So you should take your time to make sure that your website is exactly what you need it to be. Don’t rush it. It is an important step in the direction of success for your business.

The post Building a Successful Website appeared first on SiteProNews.

What Is the Difference between WordPress Hosting and Managed WordPress Hosting?

posted on July 20, 2021

tags:

If you’re building a website for your business or blog, choosing to use WordPress is only one of the many decisions you’ll need to make. You still have to select the right theme for your site, figure out which plugins to use, and decide whether or not to use managed WordPress hosting.

Managed WordPress hosting means an experienced WordPress hosting expert takes care of your website after it’s been built. They deal with all the tedious (yet supremely important) technical maintenance jobs like updating themes and plugins, backing up the site, and improving its speed and performance, as well as protecting your site from hackers.

Of course, managed WordPress hosting takes another task off your to-do list, but if you’re just getting started with a new business, you’re probably trying to save money whenever you can. You might wonder “is there really a big difference between managed WordPress hosting and regular WordPress hosting?â€Â

Don’t worry, we aren’t offended when people ask this question. Here is our explanation about what the difference is between managed and regular WordPress hosting.

WordPress Hosting vs Managed WordPress Hosting – What’s the Difference?

Every WordPress hosting company is going to manage the website server itself. The server is like your website’s physical home, and the host looks after it. They make sure that the server is secure and working correctly, but for regular WordPress hosting, that’s as far as it goes.

With regular hosting, routine website maintenance tasks like backups, updates, and security scanning are entirely your responsibility. You’ll also be on your own when it comes to migrating information from another website, building a new site, and creating staging sites so you can experiment with new approaches. If your site slows down or stops loading smoothly, you’re the one who has to work out what is hampering its performance and how to fix it.

Now imagine that you’re using managed WordPress hosting. You’ll have an expert at your disposal who’s experienced with WordPress websites. Plus, they know the server inside and out. If something slows down your site, or you fall victim to a cyber-attack, they know exactly how to deal with the issue, so your site will be healed in the shortest possible amount of time.

Is Managed WordPress Hosting the Same as Private WordPress Hosting?

In a word, no.

Private WordPress hosting means that your website has a server all to itself, which can make it more secure, but you still have to deal with all the technical and maintenance issues. If you use shared WordPress hosting, your website is sharing a server and resources with dozens, and maybe even hundreds, of other sites, which can affect both security and performance.

Whether you use shared or private website hosting, the server will be home to websites that use many different platforms, so the server needs to offer a generic environment. But with managed WordPress hosting, whether it’s shared or private, your site nestles in an environment designed specifically for WordPress sites.

Who Needs Managed WordPress Hosting?

Websites Using Shared Hosting

You’re a lot more likely to need to fine tune your site’s speed and performance if you use shared website hosting, because if one of the other websites sees their traffic increase, it’s likely to slow down your website as a result.

It also becomes even more important to have someone on hand to maintain your site’s cyber defenses. If one site on a server gets hacked, the hackers can enter other sites on the same server a lot more easily.

Small Businesses That Can’t Afford an in-House Tech Expert

Small businesses typically run with a small staff, and everyone has to punch above their weight. It’s unlikely that anyone in your company has the time to add website maintenance to their long list of responsibilities.

But hiring a tech expert means another salary, and that’s none too easy in small businesses. Managed WordPress hosting does cost more than regular hosting, but much less than another salary. You could find a freelancer, but then you have the hassle of searching for someone who’s available, plus you might not always be able to use the same freelancer. Managed WordPress workers are always at your service.

Business Owners Who Are Not Technically Minded

If you’re a tech-oriented person who’s familiar with WordPress websites, you’ve probably got the skills you need to manage your website yourself (whether or not you have the time is another question).

But most business owners aren’t techies on the side. The on ramp to managing a WordPress site is pretty steep, and that’s not why you started your own business. Managed WordPress hosting takes it all off your shoulders.

Busy Websites That Can’t Afford Downtime

If you’re running a quiet blog, or your website is just your “calling card†but you don’t use it for sales, it probably isn’t a big deal if your site loads slowly or takes a couple of days to get back up after a glitch.

But busy websites can’t afford even an hour of downtime. Just think of the sales you could miss if your site’s not working for an hour! Plus customers will bounce off if your site takes too long to load. Managed WordPress hosting is vital when constant uptime and smooth, fast performance is crucial for revenue.

How Does Managed WordPress Hosting Help Your Business?

With managed WordPress hosting, you’ll see these benefits:

  • Peace of mind, so you can focus on growing your business instead of worrying about the website
  • More traffic to your site, because Google now considers site speed and performance when it ranks websites on its results page
  • More satisfied customers, because visitors don’t get frustrated at slow-loading pages and your website has more uptime
  • Faster recovery after a security incident

We hope we managed to explain the difference between managed WordPress hosting and regular WordPress hosting. Feel free to contact us if you have any questions about managed WordPress hosting services, or any WordPress question at all!


avatar

Ari Strauch is VP of Technical Marketing for uPress, the Managed WordPress Hosting company. Ari is not sure whether to define himself as a tech-loving people person or a people-loving techie. Either way, he’s typical of the uPress team in that he is equally fluent in Geek AND plain English, and routinely uses both to enable non-geeks and geeks alike to enjoy speedy, hack-proof, intuitive managed WordPress hosting for their websites.

The post What Is the Difference between WordPress Hosting and Managed WordPress Hosting? appeared first on SiteProNews.

User Experience: What It Is and Why You Should Care

posted on July 2, 2021

tags:

Ever wonder what user experience is and why it’s important? Also known as UX, user experience refers to every aspect of your interaction with a product, service, or company. At times, user experience is likened to customer service because it requires meeting customers’ needs as seamlessly as possible.

Just how important is user experience? Nowadays, a whopping 88% of online consumers won’t revisit a site after a bad experience. Web development experts know several elements contribute to the creation of a superb user experience. There’s user interface, responsive web design, and usability, for starters.

In essence, an exceptional user experience is all about making the end-user happy. To achieve this objective, a brand needs to have a clear and thorough understanding of the needs and priorities of consumers.

Why User Experience Matters

To fully appreciate the significance of user experience, let us examine some interesting statistics:

  • If site content is not optimized, a staggering 79% of visitors will leave the site and look for information elsewhere.
  • At least 88% of online visitors won’t revisit a site after a bad experience.
  • Superb UX design has been known to boost conversion by as much as 400%.
  • A well-designed user interface can increase the conversion rate of a site by as much as 200%.
  • Some studies also indicate that mobile users are five times more likely to leave a task unfinished if the website is not optimized.

Still not convinced? The experience of some of the world’s leading brands highlight the significant role user experience plays:

  • According to Adobe, at least 39% of visitors will leave a site right away if the loading time is slow or the images won’t load.
  • KoMarketing revealed that 51% of site visitors consider contact information as essential elements missing from most websites.
  • The revenue of ESPN jumped by 35% after they implemented some of the homepage redesign suggestions provided by their community.

Also, since Google wants to provide a great experience each time people use their search engine, it is believed that UX is considered one of the main factors that affect search engine rankings.

Why You Should Care

If you don’t make user experience a priority, you put critical aspects of your business on the line, including sales, brand reputation, and customer loyalty.

Sales

If the primary purpose of your website is to drive online sales, user experience should rank high in your list of priorities. It is important to remember that websites that load slowly have cost retailers $2.6 billion in lost sales yearly. 

At least 60 percent of consumers cite lack of information, a small screen, and slow connection as some reasons for not buying. Next, check the conversion rate of your site. Is it good enough for you? If not, poor user experience can be the likely culprit.

Brand Reputation

When a website is not visually pleasing, visitors and consumers might take it against your brand. Here’s something not many people know about: some studies pointed out that 94 percent of first impressions are related to design.

At least 60% of site visitors also stated they wouldn’t recommend a brand that has a poorly designed website. Undoubtedly, user experience has a massive impact on the overall experience.

Customer Loyalty

At least 52% of site visitors revealed that they no longer want to engage with a brand after a bad mobile experience. What is even more alarming is 79% of visitors who don’t like what they find on a specific site will search for information on other sites.

Understandably, no visitor would stay long on a site that does not contain the information they want. For those struggling to retain and entice new customers, improving the user experience should be one of your top priorities.

Effective Ways to Improve User Experience

There is no shortage of powerful ways you can improve user experience. Some of the most effective include:

Auditing your site’s flow

Examine the structure of your site. Also known as sitemap, check if the structure of your site can help visitors find what they are looking for quickly and effortlessly. If multiple steps are required, consider redesigning your site’s structure and flow.

You can use a user testing tool to understand the site paths that are considered straightforward and complex by your visitors. Aside from a good site structure, ensuring that headings are used properly can make a world of difference.

Asking your visitors how you can improve

Each time a visitor purchases from your site, send a follow-up email and ask them about their experience navigating and interacting with your site. Ensure you also ask straightforward questions and not vague ones.

Although pop-ups are vastly used for surveys of this type, chat boxes are considered ideal as they won’t intrude with any activities visitors do on the site.

Testing your site

User testing is one of the most effective ways to assess if your site provides an exceptional user experience. Nowadays, there are countless tools online that you can use. Some tools are designed to ask visitors questions about design, functionality, and web content.

Final Thoughts

The importance of user experience cannot be overemphasized. Without it, websites will be impossible to navigate and a pain to use. It is crucial to keep in mind that user experience can significantly contribute to the success of your brand. That said, make sure you provide nothing but the best experience on every visit.


avatar

Sarah Munn is the Outreach Manager of Phoenix Web Design, a web design company based in Phoenix, Arizona that specializes in creating bespoke and responsive websites that will surely grab people’s attention. When not writing content, she spends time with her grandparents and giving back to the community.

The post User Experience: What It Is and Why You Should Care appeared first on SiteProNews.

SVG Tutorial

posted on June 12, 2021

tags:

What is SVG?

  • SVG, Scalable Vector Graphics is an XML based language to define vector based graphics.

  • SVG is intended to display images over the web.

  • Being vector images, SVG image never loses quality no matter how they are zoomed out or resized.

  • SVG images supports interactivity and animation.

  • SVG is a W3C standard.

  • Others image formats like raster images can also be clubbed with SVG images.

  • SVG integrates well with XSLT and DOM of HTML.

Advantages

  • Use any text editor to create and edit SVG images.

  • Being XML based, SVG images are searchable, indexable and can be scripted and compressed.

  • SVG images are highly scalable as they never loses quality no matter how they are zoomed out or resized

  • Good printing quality at any resolution

  • SVG is an Open Standard

Disadvantages

  • Being text format size is larger then compared to binary formatted raster images.

  • Size can be big even for small image.

Example

Following XML snippet can be used to draw a circle in web browser.

<svg width="100" height="100">
   <circle cx="50" cy="50" r="40" stroke="red" stroke-width="2" fill="green" />
</svg>

Embed the SVG XML directly in an HTML page.

testSVG.htm

<html>
   <title>SVG Image</title>
   <body>
   
      <h1>Sample SVG Image</h1>
      
      <svg width="100" height="100">
         <circle cx="50" cy="50" r="40" stroke="red" stroke-width="2" fill="green" />
      </svg>
   
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. In Internet Explorer, activeX controls are required to view SVG images.

How SVG integrates with HTML

  • <svg> element indicates the start of SVG image.

  • <svg> element's width and height attributes defines the height and width of the SVG image.

  • In above example, we've used a <circle> element to draw a circle.

  • cx and cy attribute represents center of the circle. Default value is (0,0). r attribute represents radius of circle.

  • Other attributes stroke and stroke-width controls the outlining of the circle.

  • fill attribute defines the fill color of the circle.

  • Closing</svg> tag indicates the end of SVG image.

SVG - Shapes

SVG provides number of shapes which can be used to draw images. Following are the common shapes.

Sr.No. Shape Type & Description
1 rect

Used to draw a rectangle.

2 circle

Used to draw a circle.

3 ellipse

Used to draw a ellipse.

4 line

Used to draw a line.

5 polygon

Used to draw a closed shape consisting of connected straight lines.

6 polyline

Used to draw a open shape consisting of connected straight lines.

7 path

Used to draw any path.

SVG - Text

<text> element is used to draw text.

Declaration

Following is the syntax declaration of <text> element. We've shown main attributes only.

<text
  x="x-cordinates"
  y="y-cordinates"
  
  dx="list of lengths"
  dy="list of lengths"
  
  rotate="list of numbers"
  textlength="length"
  lengthAdjust="spacing" >
</text>

Attributes

Sr.No. Attribute & Description
1 x − x axis coordinates of glyphs.
2 y − y axis coordinates of glyphs.
3 dx − shift along with x-axis.
4 dy − shift along with y-axis.
5 rotate − rotation applied to all glyphs.
6 textlength − rendering length of the text.
7 lengthAdjust − type of adjustment with the rendered length of the text.

Example

testSVG.htm

<html>
   <title>SVG Text</title>
   <body>
      
      <h1>Sample SVG Text</h1>
      
      <svg width="800" height="800">
         <g>
            <text x="30" y="12" >Text: </text>
            <text x="30" y="30" fill="rgb(121,0,121)">WWW.YourSite.COM</text>
         </g> 
      </svg>
   
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

Text with rotate

<html>
   <title>SVG Text</title>
   <body>
      <h1>Sample SVG Text</h1>
      
      <svg width="800" height="800">
         <g>
            <text x="30" y="12" >Multiline Text: </text>
            <text x="30" y="30" fill="rgb(121,0,121)">WWW.yoursite.COM
            <tspan x="30" y="50" font-weight="bold">Simply Easy learning.</tspan>
            <tspan x="30" y="70">We teach just for free.</tspan>
            </text>
         </g>
      </svg>
      
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

Multiline Text

<html>
   <title>SVG Text</title>
   <body>
      <h1>Sample SVG Text</h1>
      
      <svg width="570" height="100">
         <g>
            <text x="30" y="12" >Multiline Text: </text>
            <text x="30" y="30" fill="rgb(121,0,121)">WWW.yoursite.COM
               <tspan x="30" y="50" font-weight="bold">Simply Easy learning.</tspan>
               <tspan x="30" y="70">We teach just for free.</tspan>
            </text>
         </g>
      </svg>
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

Hyper link Text

<html>
   <title>SVG Text</title>
   <body>
      <h1>Sample SVG Text</h1>
      
      <svg width="800" height="800">
         <g>
            <text x="30" y="10" >Text as Link: </text>
         
            <a xlink:href="http://www.yoursite.com/svg/" target="_blank">
               <text font-family="Verdana" font-size="20"  x="30" y="30" 
               fill="rgb(121,0,121)">WWW.yoursite.COM</text>
            </a>
         </g>
      </svg>
      
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

SVG - Stroke

SVG supports multiple stroke properties.

Following are the main stroke properties used.

Sr.No. Stroke Type & Description
1 stroke − defines color of text, line or outline of any element.
2 stroke-width − defines thickness of text, line or outline of any element.
3 stroke-linecap − defines different types of ending of a line or outline of any path.
4 stroke-dasharray − used to create dashed lines.

Example

testSVG.htm

<html>
   <title>SVG Stroke</title>
   <body>
   
      <h1>Sample SVG Stroke</h1>
      
      <svg width="800" height="800">
         <g>
            <text x="30" y="30" >Using stroke: </text>
            <path stroke="red" d="M 50 50 L 300 50" />
            <path stroke="green" d="M 50 70 L 300 70" />
            <path stroke="blue" d="M 50 90 L 300 90" />
         </g> 
      </svg>
   
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

Stroke width

<html>
   <title>SVG Stroke</title>
   <body>
      
      <h1>Sample SVG Stroke</h1>
      
      <svg width="800" height="800">
         <text x="30" y="10" >Using stroke-width: </text>
         <path stroke-width="2" stroke="black" d="M 50 50 L 300 50" />
         <path stroke-width="4" stroke="black" d="M 50 70 L 300 70" />
         <path stroke-width="6" stroke="black" d="M 50 90 L 300 90" />
      </svg>
      
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

stroke-linecap

<html>
   <title>SVG Stroke</title>
   <body>
      
      <h1>Sample SVG Stroke</h1>
      
      <svg width="800" height="800">
         <g>
            <text x="30" y="30" >Using stroke-linecap: </text>
         
            <path stroke-linecap="butt" stroke-width="6" 
            stroke="black" d="M 50 50 L 300 50" />
         
            <path stroke-linecap="round" stroke-width="6" 
            stroke="black" d="M 50 70 L 300 70" />
         
            <path stroke-linecap="square" stroke-width="6"
            stroke="black" d="M 50 90 L 300 90" />
         </g>
      </svg>
   
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

stroke-dasharray

<html>
   <title>SVG Stroke</title>
   <body>
   
      <h1>Sample SVG Stroke</h1>
      
      <svg width="800" height="800">
         <g>
            <text x="30" y="30" >Using stroke-dasharray: </text>
            
            <path stroke-dasharray="5,5" stroke-width="6" 
            stroke="black" d="M 50 50 L 300 50" />
            
            <path stroke-dasharray="10,10" stroke-width="6" 
            stroke="black" d="M 50 70 L 300 70" />
            
            <path stroke-dasharray="20,10,5,5,5,10" stroke-width="6" 
            stroke="black" d="M 50 90 L 300 90" />
         </g>
      </svg>
   
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

SVG - Filters

SVG uses <filter> element to define filters. <filter> element uses an id attribute to uniquely identify it.Filters are defined within <def> elements and then are referenced by graphics elements by their ids.

SVG provides a rich set of filters. Following is the list of the commonly used filters.

  • feBlend
  • feColorMatrix
  • feComponentTransfer
  • feComposite
  • feConvolveMatrix
  • feDiffuseLighting
  • feDisplacementMap
  • feFlood
  • feGaussianBlur
  • feImage
  • feMerge
  • feMorphology
  • feOffset - filter for drop shadows
  • feSpecularLighting
  • feTile
  • feTurbulence
  • feDistantLight
  • fePointLight
  • feSpotLight

Declaration

Following is the syntax declaration of <filter> element. We've shown main attributes only.

<filter
   filterUnits="units to define filter effect region"
   primitiveUnits="units to define primitive filter subregion"
   
   x="x-axis co-ordinate" 
   y="y-axis co-ordinate"     
   
   width="length"
   height="length"
   
   filterRes="numbers for filter region"
   xlink:href="reference to another filter" >
</filter>

Attributes

Sr.No. Name & Description
1 filterUnits − units to define filter effect region. It specifies the coordinate system for the various length values within the filter and for the attributes defining the filter subregion. If filterUnits="userSpaceOnUse", values represent values in the current user coordinate system in place at the time when the 'filter' element is used. If filterUnits="objectBoundingBox", values represent values in fractions or percentages of the bounding box on the referencing element in place at the time when the 'filter' element is used. Default is userSpaceOnUse.
2 primitiveUnits − units to define filter effect region. It specifies the coordinate system for the various length values within the filter and for the attributes defining the filter subregion. If filterUnits="userSpaceOnUse", values represent values in the current user coordinate system in place at the time when the 'filter' element is used. If filterUnits="objectBoundingBox", values represent values in fractions or percentages of the bounding box on the referencing element in place at the time when the 'filter' element is used. Default is userSpaceOnUse.
3 x − x-axis co-ordinate of the filter bounding box. Defeault is 0.
4 y − y-axis co-ordinate of the filter bounding box. Default is 0.
5 width − width of the filter bounding box. Default is 0.
6 height − height of the filter bounding box. Default is 0.
7 filterRes − numbers representing filter regions.
8 xlink:href − used to refer to another filter.

Example

testSVG.htm

<html>
   <title>SVG Filter</title>
   <body>
   
      <h1>Sample SVG Filter</h1>
   
      <svg width="800" height="800">
      
         <defs>
            <filter id="filter1" x="0" y="0">
               <feGaussianBlur in="SourceGraphic" stdDeviation="8" />
            </filter>
            
            <filter id="filter2" x="0" y="0" width="200%" height="200%">
               <feOffset result="offOut" in="SourceAlpha" dx="20" dy="20" />
               <feGaussianBlur result="blurOut" in="offOut" stdDeviation="10" />
               <feBlend in="SourceGraphic" in2="blurOut" mode="normal" />
            </filter>
         </defs>
         
         <g>
            <text x="30" y="50" >Using Filters (Blur Effect): </text>
            <rect x="100" y="100" width="90" height="90" stroke="green" stroke-width="3"
            fill="green" filter="url(#filter1)" />      
         </g> 
         
      </svg>
   
   </body>
</html>
  • Two <filter> elements defined as filter1 and filter2.

  • feGaussianBlur filter effect defines the blur effect with the amount of blur using stdDeviation.

  • in="SourceGraphic" defines that the effect is applicable for the entire element.

  • feOffset filter effect is used to create shadow effect. in="SourceAlpha" defines that the effect is applicable for the alpha part of RGBA graphics.

  • <rect> elements linked the filters using filter attribute.

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

Filter with Shadow effect

<html>
   <title>SVG Filter</title>
   <body>
      
      <h1>Sample SVG Filter</h1>
      
      <svg width="800" height="800">
      
         <defs>
            <filter id="filter1" x="0" y="0">
               <feGaussianBlur in="SourceGraphic" stdDeviation="8" />
            </filter>
            
            <filter id="filter2" x="0" y="0" width="200%" height="200%">
               <feOffset result="offOut" in="SourceAlpha" dx="20" dy="20" />
               <feGaussianBlur result="blurOut" in="offOut" stdDeviation="10" />
               <feBlend in="SourceGraphic" in2="blurOut" mode="normal" />
            </filter>
         </defs>
         
         <g>
            <text x="30" y="50" >Using Filters (Shadow Effect): </text>
            <rect x="100" y="100" width="90" height="90" stroke="green" stroke-width="3"
            fill="green" filter="url(#filter2)" />
         </g>
         
      </svg>
   
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

SVG - Patterns

SVG uses <pattern> element to define patterns. Patterns are defined using <pattern> element and are used to fill graphics elements in tiled fashion.

Declaration

Following is the syntax declaration of <pattern> element. We've shown main attributes only.

<pattern
   patternUnits="units to define x,y, width and height attributes."
   patternContentUnits ="units to define co-ordinate system of contents of pattern"
   patternTransform = "definition of an additional transformation from the pattern coordinate system onto the target coordinate system"
   
   x="x-axis co-ordinate" 
   y="y-axis co-ordinate"     
   
   width="length"
   height="length"
   
   preserveAspectRatio="to preserve width/height ratio of original content"
   xlink:href="reference to another pattern" >
</pattern>

Attributes

Sr.No. Name & Description
1 patternUnits − units to define patterns effect region. It specifies the coordinate system for the various length values within the pattern and for the attributes defining the pattern subregion. If patternUnits="userSpaceOnUse", values represent values in the current user coordinate system in place at the time when the 'pattern' element is used. If patternUnits="objectBoundingBox", values represent values in fractions or percentages of the bounding box on the referencing element in place at the time when the 'pattern' element is used. Default is userSpaceOnUse.
2 patternContentUnits − units to define pattern content region. It specifies the coordinate system for the various length values within the pattern and for the attributes defining the pattern subregion. If patternContentUnits="userSpaceOnUse", values represent values in the current user coordinate system in place at the time when the 'pattern' element is used. If patternContentUnits="objectBoundingBox", values represent values in fractions or percentages of the bounding box on the referencing element in place at the time when the 'pattern' element is used. Default is userSpaceOnUse.
3 x − x-axis co-ordinate of the pattern bounding box. Defeault is 0.
4 y − y-axis co-ordinate of the pattern bounding box. Default is 0.
5 width − width of the pattern bounding box. Default is 0.
6 height − height of the pattern bounding box. Default is 0.
7 preserveAspectRatio - to preserve width/height ratio of original content.
8 xlink:href − used to refer to another pattern.

Example

testSVG.htm

<html>
   <title>SVG Pattern</title>
   <body>
      <h1>Sample SVG Pattern</h1>
      
      <svg width="800" height="800">
         
         <defs>
            <pattern id="pattern1" patternUnits="userSpaceOnUse"
               x="0" y="0" width="100" height="100"
               viewBox="0 0 4 4" >
               <path d="M 0 0 L 3 0 L 1.5 3 z" fill="blue" stroke="green" />
            </pattern> 
         </defs>
         
         <g>
            <text x="30" y="50" >Using Pattern (Triangles): </text>
            <rect x="100" y="100" width="300" height="300" stroke="green" 
            stroke-width="3" fill="url(#pattern1)" />
         </g> 
         
      </svg>
   
   </body>
</html>
  • One <pattern> element defined as pattern1.

  • In pattern, a viewbox is defined and a path which is to be used as pattern is defined.

  • in rect element, in fill attribute, url of the pattern is specified to fill the rectangle with pattern created earlier.

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

SVG - Gradients

Gradient refers to smooth transition of one color to another color within a shape. SVG provides two types of gradients.

  • Linear Gradients − Represents linear transition of one color to another from one direction to another.

  • Radial Gradients − Represents circular transition of one color to another from one direction to another.

Linear Gradients

Declaration

Following is the syntax declaration of <linearGradient> element. We've shown main attributes only.

<linearGradient
   gradientUnits ="units to define co-ordinate system of contents of gradient"
   gradientTransform = "definition of an additional transformation from the gradient coordinate system onto the target coordinate system"
   
   x1="x-axis co-ordinate" 
   y1="y-axis co-ordinate"     
   x2="x-axis co-ordinate" 
   y2="y-axis co-ordinate"     
   
   spreadMethod="indicates method of spreading the gradient within graphics element"
   xlink:href="reference to another gradient" >
</linearGradient>

Attributes

Sr.No. Name & Description
1 gradientUnits − units to define the coordinate system for the various length values within the gradient. If gradientUnits="userSpaceOnUse", values represent values in the current user coordinate system in place at the time when the gradient element is used. If patternContentUnits="objectBoundingBox", values represent values in fractions or percentages of the bounding box on the referencing element in place at the time when the gradient element is used. Default is userSpaceOnUse.
2 x1 − x-axis co-ordinate of the gradient vector. Defeault is 0.
3 y1 − y-axis co-ordinate of the gradient vector. Default is 0.
4 x2 − x-axis co-ordinate of the gradient vector. Defeault is 0.
5 y2 − y-axis co-ordinate of the gradient vector. Default is 0.
6 spreadMethod − indicates method of spreading the gradient within graphics element. Default is 'pad'.
7 xlink:href − used to refer to another gradient.

Example

testSVG.htm

<html>
   <title>SVG Linear Gradient</title>
   <body>
   
      <h1>Sample SVG Linear Gradient</h1>
   
      <svg width="600" height="600">
      
         <defs>
            <linearGradient id="sampleGradient">
               <stop offset="0%" stop-color="#FF0000" />
               <stop offset="100%" stop-color="#00FFF00" />
            </linearGradient>
         </defs>
         
         <g>
            <text x="30" y="50" >Using Linear Gradient: </text>
            <rect x="100" y="100" width="200" height="200" stroke="green" stroke-width="3" 
            fill="url(#sampleGradient)" />
         </g>
         
      </svg>
   
   </body>
</html>
  • One <linearGradient> element defined as sampleGradient.

  • In linearGradient, two offsets are defined with two colors.

  • in rect element, in fill attribute, url of the gradient is specified to fill the rectangle with gradient created earlier.

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

Radial Gradients

Declaration

Following is the syntax declaration of <radialGradient> element. We've shown main attributes only.

<radialGradient
   gradientUnits ="units to define co-ordinate system of contents of gradient"
   gradientTransform = "definition of an additional transformation from the gradient coordinate system onto the target coordinate system"
   
   cx="x-axis co-ordinate of center of circle." 
   cy="y-axis co-ordinate of center of circle."     
   
   r="radius of circle" 
   
   fx="focal point for the radial gradient"     
   fy="focal point for the radial gradient"     
   
   spreadMethod="indicates method of spreading the gradient within graphics element"
   xlink:href="reference to another gradient" >
</radialGradient>

Attributes

Sr.No. Name & Description
1 gradientUnits − units to define the coordinate system for the various length values within the gradient. If gradientUnits="userSpaceOnUse", values represent values in the current user coordinate system in place at the time when the gradient element is used. If patternContentUnits="objectBoundingBox", values represent values in fractions or percentages of the bounding box on the referencing element in place at the time when the gradient element is used. Default is userSpaceOnUse.
2 cx − x-axis co-ordinate of the center of largest circle of gradient vector. Defeault is 0.
3 cy − y-axis co-ordinate of the center of largest circle of gradient vector. Default is 0.
4 r − radius of the center of largest circle of gradient vector. Defeault is 0.
5 fx − focal point of radial gradient. Default is 0.
6 fy − focal point of radial gradient. Default is 0.
7 spreadMethod − indicates method of spreading the gradient within graphics element. Default is 'pad'.
8 xlink:href − used to refer to another gradient.

Example

testSVG.htm

<html>
   <title>SVG Radial Gradient</title>
   <body>
      
      <h1>Sample SVG Radial Gradient</h1>
      
      <svg width="600" height="600">
         <defs>
            <radialGradient id="sampleGradient">
               <stop offset="0%" stop-color="#FF0000" />
               <stop offset="100%" stop-color="#00FFF00" />
            </radialGradient>
         </defs>
         
         <g>
            <text x="30" y="50" >Using Radial Gradient: </text>
            <rect x="100" y="100" width="200" height="200" stroke="green" stroke-width="3"
            fill="url(#sampleGradient)" />
         </g>
      </svg>
      
   </body>
</html>
  • One <radialGradient> element defined as sampleGradient.

  • In radialGradient, two offsets are defined with two colors.

  • in rect element, in fill attribute, url of the gradient is specified to fill the rectangle with gradient created earlier.

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering.

SVG - Interactivity

SVG images can be made responsive to user actions. SVG supports pointer events, keyboard events and document events. Consider the following example.

Example

testSVG.htm

<html>
   <title>SVG Interactivity</title>
   <body>
      
      <h1>Sample Interactivity</h1>
      
      <svg width="600" height="600">
         <script type="text/JavaScript">
            <![CDATA[
               function showColor() {
                  alert("Color of the Rectangle is: "+
                  document.getElementById("rect1").getAttributeNS(null,"fill"));
               }
               
               function showArea(event){
                  var width = parseFloat(event.target.getAttributeNS(null,"width"));
                  var height = parseFloat(event.target.getAttributeNS(null,"height"));
                  alert("Area of the rectangle is: " +width +"x"+ height);
               }
               
               function showRootChildrenCount() {
                  alert("Total Children: "+document.documentElement.childNodes.length);
               }
            ]]>
         </script>
         
         <g>
            <text x="30" y="50" onClick="showColor()">Click me to show rectangle color.</text>
            
            <rect id="rect1" x="100" y="100" width="200" height="200" 
            stroke="green" stroke-width="3" fill="red" 
            onClick="showArea(event)"/>
            
            <text x="30" y="400" onClick="showRootChildrenCount()">
            Click me to print child node count.</text>
         </g>
      </svg>
   
   </body>
</html>

Explaination

  • SVG supports JavaScript/ECMAScript functions. Script block is to be in CDATA block consider character data support in XML.

  • SVG elements support mouse events, keyboard events. We've used onClick event to call a javascript functions.

  • In javascript functions, document represents SVG document and can be used to get the SVG elements.

  • In javascript functions, event represents current event and can be used to get the target element on which event got raised.

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering. Click on each text and rectangle to see the result.

SVG - Linking

<a> element is used to create hyperlink. "xlink:href" attribute is used to pass the IRI (Internationalized Resource Identifiers) which is complementary to URI (Uniform Resource Identifiers).

Declaration

Following is the syntax declaration of <a> element. We've shown main attributes only.

<a
   xlink:show = "new" | "replace"
   xlink:actuate = "onRequest"
   xlink:href = "<IRI>"
   target = "_replace" | "_self" | "_parent" | "_top" | "_blank" | "<XML-Name>" >
</a>

Attributes

Sr.No. Name & Description
1 xlink:show − for documentation purpose for XLink aware processors. Default is new.
2 xlink:actuate − for documentation purpose for XLink aware processors.
3 xlink:href − location of the referenced object.
4 target − used when targets for the ending resource are possible.

Example

testSVG.htm

<html>
   <title>SVG Linking</title>
   <body>
   
      <h1>Sample Link</h1>
      
      <svg width="800" height="800">
         <g>
            <a xlink:href="http://www.yoursite.com"> 
               <text x="0" y="15" fill="black" >
               Click me to load yoursite DOT COM.</text>
            </a>
         </g> 
         
         <g>
            <text x="0" y="65" fill="black" >
            Click in the rectangle to load yoursite DOT COM</text>
            
            <a xlink:href="http://www.yoursite.com"> 
               <rect x="100" y="80" width="300" height="100"
               style="fill:rgb(121,0,121);stroke-width:3;stroke:rgb(0,0,0)" /> 
            </a>
         </g>
      </svg>
   
   </body>
</html>

Output

Open textSVG.htm in Chrome web browser. You can use Chrome/Firefox/Opera to view SVG image directly without any plugin. Internet Explorer 9 and higher also supports SVG image rendering. Click on link and rectangle to see the result.

script.aculo.us Tutorial

posted on June 11, 2021

tags:

What is script.aculo.us?

script.aculo.us is a JavaScript library built on top of the Prototype JavaScript Framework, enhancing the GUI and giving Web 2.0 experience to the web users.

script.aculo.us was developed by Thomas Fuchs and it was first released to the public in June 2005.

script.aculo.us provides dynamic visual effects and user interface elements via the Document Object Model (DOM).

The Prototype JavaScript Framework is a JavaScript framework created by Sam Stephenson that provides an Ajax framework and other utilities.

How to Install script.aculo.us?

It is quite simple to install the script.aculo.us library. It can be set up in three simple steps −

  • Go to the download page to download the latest version in a convenient package.

  • Unpack the downloaded package and you will find the following folders −

    • lib − contains prototype.js file.

    • src − contains the following 8 files −

      • builder.js
      • controls.js
      • dragdrop.js
      • effects.js
      • scriptaculous.js
      • slider.js
      • sound.js
      • unittest.js
    • test − contains files for testing purpose.

    • CHANGELOG − File that contains the history of all the changes.

    • MIT-LICENSE − File describing the licensing terms.

    • README − File describing the installation package including the installation instructions.

  • Now put the following files in a directory of your website, e.g. /javascript.

    • builder.js
    • controls.js
    • dragdrop.js
    • effects.js
    • scriptaculous.js
    • slider.js
    • prototype.js

NOTE − The sound.js and unittest.js files are optional

How to Use script.aculo.us Library?

Now you can include script.aculo.us script as follows −


   
      </span><span class="pln">script.aculo.us examples</span><span class="tag">
      
      

Dragging Things Around

It is very simple to make an item draggable using script.aculo.us. It requires creating an instance of the Draggable class, and identifying the element to be made draggable.

Draggable Syntax

new Draggable( element, options );

The first parameter to the constructor identifies the element to be made draggable either as the id of the element, or a reference to the element. The second parameter specifies optional information on how the draggable element is to behave.

Draggable Options

You can use one or more of the following options while creating your draggable object.

Option Description Examples
revert If set to true, the element returns to its original position when the drag ends. Also specifies whether the reverteffect callback will be invoked when the drag operation stops. Defaults to false.

Example

snap Used to cause a draggable to snap to a grid or to constrain its movement. If false (default), no snapping or constraining occurs.
  • If it is assigned an integer x, the draggable will snap to a grid of x pixels.

  • If an array [x, y], the horizontal dragging will snap to a grid of x pixels and the vertical will snap to y pixels.

  • It can also be a function conforming to Function( x , y , draggable ) that returns an array [x, y].

Example

zindex Specifies the CSS z-index to be applied to the element during a drag operation. By default, the element's z-index is set to 1000 while dragging.

Example

ghosting Boolean determining whether the draggable should be cloned for dragging, leaving the original in place until the clone is dropped. Defaults to false.

Example

constraint A string used to limit the draggable directions, either horizontal or vertical. Defaults to null which means free movement.

Example

handle Specifies an element to be used as the handle to start the drag operation. By default, an element is its own handle.

Example

starteffect An effect called on element when dragging starts. By default, it changes the element's opacity to 0.2 in 0.2 seconds.

Example

reverteffect An effect called on element when the drag is reverted. Defaults to a smooth slide to element's original position.Called only if revert is true.

Example

endeffect An effect called on element when dragging ends. By default, it changes the element's opacity to 1.0 in 0.2 seconds.

Example

Callback Options

Additionally, you can use any of the following callback functions in the options parameter −

Function Description Examples
onStart Called when a drag is initiated.

Example

onDrag Called repeatedly when a mouse moves, if mouse position changes from previous call.

Example

change Called just as onDrag (which is the preferred callback).

Example

onEnd Called when a drag is ended.

Example

Except for the "change" callback, each of these callbacks accepts two parameters: the Draggable object, and the mouse event object.

Draggable Example

Here, we define 5 elements that are made draggable: three

elements, an element, and a element. The purpose of the three different
elements is to demonstrate that regardless of whether an element starts off with a positioning rule of static (the default), relative, or absolute, the drag behavior is unaffected.

 

Live Demo

   
      </span><span class="pln">Draggables Elements</span><span class="tag">
		
      
      
      
      
   

   
       id = "normaldiv">
         This is a normal div and this is dragable.
      
id = "relativediv" style="position: relative;"> This is a relative div and this is dragable.

id = "absolutediv" style="position: absolute;"> This is an absolute div and this dragable. /> id = "image" src = "/images/scriptaculous.gif"/>

Let part id = "span" style = "color: blue;"> This is middle part Yes, only middle part is dragable.

This will produce following result −

Dropping Dragged Things

An element is converted into a drop target via a call to the add() method within a namespace called Droppables.

The Droppables namespace has two important methods: add() to create a drop target, and remove() to remove a drop target.

Syntax

Here is the syntax of the add() method to create a drop target. The add() method creates a drop target out of the element passed as its first parameter, using the options in the hash passed as the second.

Droppables.add( element, options );

The syntax for remove() is even more simpler. The remove() method removes the drop target behavior from the passed element.

Droppables.remove(element);

Options

You can use one or more of the following options while creating your draggable object.

Option Description Examples
Hoverclass The name of a CSS class that will be added to the element while the droppable is active (has an acceptable draggable hovering over it). Defaults to null.

Example

Accept A string or an array of strings describing CSS classes. The droppable will only accept draggables that have one or more of these CSS classes.

Example

Containment Specifies an element, or array of elements, that must be a parent of a draggable item in order for it to be accepted by the drop target. By default, no containment constraints are applied.

Example

Overlap If set to 'horizontal' or 'vertical', the droppable will only react to a Draggable if its overlapping by more than 50% in the given direction. Used by Sortables, discussed in the next chapter.
greedy If true (default), it stops hovering other droppables, under the draggable won't be searched.

Example

Callback Options

Additionally, you can use any of the following callback functions in the options parameter −

Function Description Examples
onHover Specifies a callback function that is activated when a suitable draggable item hovers over the drop target. Used by Sortables, discussed in the next chapter.
onDrop Specifies a callback function that is called when a suitable draggable element is dropped onto the drop target.

Example

Example

Here, the first part of this example is similar to our previous example, except that we have used Prototype's handy $A() function to convert a node list of all the elements in the element with the id of draggables to an array.

Live Demo

   
      </span><span class="pln">Drag and Drop Example</span><span class="tag">
		
      
      
		
      

      

This will produce following result −

script.aculo.us - Sorting Elements

Many times, you need to provide the user with the ability to reorder elements (such as items in a list) by dragging them.

Without drag and drop, reordering can be a nightmare, but script.aculo.us provides extended reordering support out of the box through the Sortable class. The element to become Sortable is passed to the create() method in the Sortable namespace.

A Sortable consists of item elements in a container element. When you create a new Sortable, it takes care of the creation of the corresponding Draggables and Droppables.

To use script.aculo.us's Sortable capabilities, you'll need to load the dragdrop module, which also requires the effects module. So your minimum loading for script.aculo.us will look like this −



Sortable Syntax

Here is the syntax of the create() method to create a sortable item. The create() method takes the id of a container element and sorts them out based on the passed options.

Sortable.create('id_of_container',[options]);

Use Sortable.destroy to completely remove all the event handlers and references to a Sortable created by Sortable.create.

NOTE − A call to Sortable.create, implicitly calls on Sortable.destroy if the referenced element was already a Sortable. Here is the simple syntax to call the destroy function.

Sortable.destroy( element );

Sortable Options

You can use one or more of the following options while creating your Sortable object.

Sr.No Option & Description
1

tag

Specifies the type of the elements within the sortable container that are to be sortable via drag and drop. Defaults to 'li'.

2

only

Specifies a CSS class name, or array of class names, that a draggable item must posses in order to be accepted by the drop target. This is similar to the accept option of Draggable. By default, no class name constraints are applied.

3

overlap

One of false, horizontal or vertical. Controls the point at which a reordering is triggered. Defaults to vertical.

4

constraint

One of false, horizontal or vertical. Constrains the movement of dragged sortable elements. Defaults to vertical.

5

containment

Enables dragging and dropping between Sortables. Takes an array of elements or element-ids. Important note: To ensure that two way dragging between containers is possible, place all Sortable.create calls after the container elements.

6

handle

Same as the Draggable option of the same name, specifying an element to be used to initiate drag operations. By default, each element is its own handle.

7

hoverclass

Specifies a CSS class name to be applied to non-dragged sortable elements as a dragged element passes over them. By default, no CSS class name is applied.
8

ghosting

Similar to the Draggable option of the same name, If true, this option causes the original element of a drag operation to stay in place while a semi-transparent copy of the element is moved along with the mouse pointer. Defaults to false. This option does not work with IE.

9

dropOnEmpty

If true, it allows sortable elements to be dropped onto an empty list. Defaults to false.

10

scroll

If the sortable container possesses a scrollbar due to the setting of the CSS overflow attribute, this option enables auto-scrolling of the list beyond the visible elements. Defaults to false.

12

scrollSensitivity

When scrolling is enabled, it adjusts the point at which scrolling is triggered. Defaults to 20.

13

scrollSpeed

When scrolling is enabled, it adjusts the scroll speed. Defaults to 15.

14

tree

If true, it enables sorting with sub-elements within the sortable element. Defaults to false.

15

treeTag

If the tree option is enabled, it specifies the container element type of the sub-element whose children takes part in the sortable behavior. Defaults to 'ul'.

You can provide the following callbacks in the options parameter −

Sr.No Option & Description
1

onChange

A function that will be called upon whenever the sort order changes while dragging. When dragging from one Sortable to another, the callback is called once on each Sortable. Gets the affected element as its parameter.

2

onUpdate

A function that will be called upon the termination of a drag operation that results in a change in element order.

Sorting Examples

This demo has been verified to work in IE 6.0. It also works in the latest version of Firefox.

Live Demo

   
      </span><span class="pln">Sorting Example</span><span class="tag">
		
      
      
		
      

      

Use our online compiler for a better understanding of the code with different options discussed in the above table.

This will produce following result −

Note the usage of tag:'li'. Similarly, you can sort the following list of images available in

 

Live Demo

   
      </span><span class="pln">Sorting Example</span><span class="tag">
		
      
      
		
      

      

This will produce following result −

Serializing the Sortable Elements

The Sortable object also provides a function Sortable.serialize() to serialize the Sortable in a format suitable for HTTP GET or POST requests. This can be used to submit the order of the Sortable via an Ajax call.

Syntax

Sortable.serialize(element, options);

Options

You can use one or more of the following options while creating your Sortable object.

Sr.No Option & Description
1

tag

Sets the kind of tag that will be serialized. This will be similar to what is used in Sortable.create.

2

name

Sets the name of the key that will be used to create the key/value pairs for serializing in HTTP GET/POST format. So if the name were to be xyz, the query string would look like −

xyz[]=value1 & xyz[]=value2 & xyz[]=value3

Where the values are derived from the child elements in the order that they appear within the container.

Serialize Examples

In this example, the output of the serialization will only give the numbers after the underscore in the list item IDs.

To try, leave the lists in their original order, press the button to see the serialization of the lists. Now, re-order some elements and click the button again.

Live Demo

   
      </span><span class="pln">Sorting Example</span><span class="tag">
		
      
      
		
       

This will produce following result −

Moving Items between Sortables

The following example shows how to move items from one list to another list.

Live Demo

   
      </span><span class="pln">Sorting Example</span><span class="tag">
		
      
      
		
      

      

Note that the containment option for each container lists both the containers as containment elements. By doing so, we have enabled the child elements to be sorted within the context of their parent; It also enables them to be moved between the two containers.

We set dropOnEmpty to true for both the lists. To see the effect this option has on that list, move all the elements from one list into other so that one list is empty. You will find that it is allowing to drop element on empty list.

This will produce following result −

Binding to Ajax

Of course, onUpdate is a prime candidate for triggering Ajax notifications to the server, for instance when the user reorders a to-do list or some other data set. Combining Ajax.Request and Sortable.serialize makes live persistence simple enough −

Live Demo

   
      </span><span class="pln">Sorting Example</span><span class="tag">
		
      
      
      
      

      

Sortable.serialize creates a string like: List[] = 1 & List[] = 2 & List[] = 3 &List[] = 4, where the numbers are the identifier parts of the list element ids after the underscore.

Now we need to code file.php, which will parse posted data as parse_str($_POST['data']); and you can do whatever you want to do with this sorted data.

To learn more about AJAX, please go through our simple Ajax Tutorial.

script.aculo.us - Create Sliders

Sliders are thin tracks with one or more handles on them that the user can drag along the track.

The goal of a slider is to provide an alternative input method for defining a numerical value; the slider represents a range, and sliding a handle along the track defines a value within this range.

Sliders can be in either horizontal or vertical orientation. When horizontal, the left end of the track usually represents the lowest value, while in a vertical orientation, the bottom of the slide is usually the lowest value.

To use script.aculo.us's slider capabilities, you'll need to load the slider.js module along with the prototype.js module. So your minimum loading for script.aculo.us will look like this −



      
		
      
		
      

Points to note −

  • You can change the slider image of any slider using CSS. Use CSS properties background-image: url(track.gif) and background-repeat: no-repeat to set the slider image.

  • The range value can be specified using $R(minValue, MaxValue). For example, $R(1, 100).

  • The range value can be specified in terms of specific values. For example values: [1,25,50,75,100]. In this case, the slider would only achieve the discrete values listed as the handle was moved.

  • At any time, the value of the slider can be set under program control by calling the setValue() method of the slider instance, as in: sliderInstance.setValue(50);

This will produce following result −

script.aculo.us - Auto Completion

Out of the box, script.aculo.us supports two sources for auto-completion −

  • Remote sources (obtained through Ajax),
  • Local sources (string arrays in your web page's scripts).

Depending on the source you're planning to use, you'll instantiate Ajax.Autocompleter or Autocompleter.Local, respectively. Although equipped with specific options, these two objects share a large feature set and provide a uniform user experience.

There are four things you'll always pass to these objects while building them −

  • The text field you want to make autocompletable. As usual, you can pass the field itself or the value of its id = attribute.

  • The container for autocompletion choices, which will end up holding a

      list of options to pick from. Again, pass the element directly or its id =. This element is most often a simple
      .

       

       

    • The data source, which will be expressed, depending on the source type, as a JavaScript array of strings or as a URL to the remote source.

    • Finally, the options. As always, they're provided as a hash of sorts, and both autocompletion objects can make do with no custom option; there are suitable defaults for everything.

    To use script.aculo.us's autocompletion capabilities, you'll need to load the controls.js and effects.js modules along with the prototype.js module. So, your minimum loading for script.aculo.us will look like this −

    
    
    

    Creating an Ajax Auto-Completer

    The construction syntax is as follows −

    new Ajax.Autocompleter(element, container, url [ , options ] )
    

    The constructor for the Ajax.Autocompleter accepts four parameters −

    • The element name or reference to a text field that is to be populated with a data choice.

    • The element name or reference to a

      element to be used as a menu of choices by the control.

       

    • The URL of the server-side resource that will supply the choices.

    • The usual options hash.

    Options

    You can use one or more of the following options while creating your Ajax.Autocompleter object.

    Sr.No Option & Description
    1

    paramName

    The name of the query parameter containing the content of the text field that is posted to the server-side resource. Defaults to the name of the text field.

    2

    minChars

    Number of characters that must be entered before a server-side request for choices can be fired off. Defaults to 1.

    3

    Frequency

    The interval, in seconds, between internal checks to see if a request to the server-side resource should be posted. Defaults to 0.4.

    4

    Indicator

    The id or reference to an element to be displayed while a server-side request for choices is underway. If omitted, no element is revealed.

    5

    Parameters

    A text string containing extra query parameters to be passed to the server-side resource.

    6

    updateElement

    A callback function to be triggered when the user selects one of the choices returned from the server that replaces the internal function that updates the text field with the chosen value.

    7

    afterUpdateElement

    A callback function to be triggered after the updateElement function has been executed.

    8

    Tokens

    A single text string, or array of text strings that indicate tokens to be used as delimiters to allow multiple elements to be entered into the text field, each of which can be auto-completed individually.

    Example

    Live Demo
    
       
          </span><span class="pln">Simple Ajax Auto-completer Example</span><span class="tag">
    		
          
          
          
          
       
       
       
          

    Type something in this box and then select suggested option from the list

    Text field: type = "text" id = "autoCompleteTextField"/> id = "autoCompleteMenu">

    Now, we need a server side to access this page and serve the data source URL (serverSideScript.php). You will keep a complete logic to display suggestions in this script.

    Just for example, we are keeping a simple HTML text in serverSideScript.php. You can write your script using CGI, PHP, Ruby, or any other server side scripting to choose appropriate suggestions and format them in the form of

    • ...
    and pass them back to the caller program.

     

    • One
    • Two
    • Three
    • Four
    • Five
    • Six

    This will produce following result −

    with different options discussed in the above table.

    Creating a Local Auto-Completer

    Creating a local auto-completer is almost identical to creating an Ajax Auto-completer as we have discussed in the previous section.

    The major difference lies in how the backing data set to use for auto-completion is identified to the control.

    With an Ajax Auto-completer, we have supplied the URL of a server-side resource that would perform the necessary filtering, given the user input, and return only the data elements that matched. With a Local Autocompleter, we supply the full list of data element instead, as a JavaScript String array, and the control itself performs the filtering operation within its own client code.

    The whole construction syntax is actually as follows −

    new Autocompleter.Local(field, container, dataSource [ , options ] );
    

    The constructor for the Autocompleter.Local accepts four parameters −

    • The element name or reference to a text field that is to be populated with a data choice.

    • The element name or reference to a

      element to be used as a menu of choices by the control

       

    • For the third parameter, instead of a URL as with the server-assisted auto-completer, we supply a small String array, which contains all of the possible values.

    • The usual options hash.

    Options

    You can use one or more of the following options while creating your Autocompleter.Local object.

    Sr.No Option & Description
    1

    Choices

    The number of choices to display. Defaults to 10.

    2

    partialSearch

    Enables matching at the beginning of words embedded within the completion strings. Defaults to true.

    3

    fullSearch

    Enables matching anywhere within the completion strings. Defaults to false.

    4

    partialChars

    Defines the number of characters that must be typed before any partial matching is attempted. Defaults to 2.

    5

    ignoreCase

    Ignores case when matching. Defaults to true.

    Example

    Live Demo
    
       
          </span><span class="pln">Simple Ajax Auto-completer Example</span><span class="tag">
    		
          
          
          
          
       
    
       
          

    Type something in this box and then select suggested option from the list

    Text field: type = "text" id = "autoCompleteTextField"/> id = "autoCompleteMenu">

    When displayed, and after the character 'a' is typed into the text box, it displays all the matching options.

    Use our online compiler for a better understanding of the code with different options discussed in the above table.

    This will produce following result −

    script.aculo.us - In-Place Editing

    In-place editing is one of the hallmarks of Web 2.0.style applications.

    In-place editing is about taking non-editable content, such as a

    ,

    , or
    , and letting the user edit its contents by simply clicking it.

     

    This turns the static element into an editable zone (either singleline or multiline) and pops up submit and cancel buttons (or links, depending on your options) for the user to commit or roll back the modification.

    It then synchronizes the edit on the server side through Ajax and makes the element non-editable again.

    To use script.aculo.us's in-place editing capabilities, you'll need to load the controls.js and effects.js modules along with the prototype.js module. So, your minimum loading for script.aculo.us will look like this −

    
    
    

    Creating an In-Place Text Editor

    The whole construction syntax is as follows −

    new Ajax.InPlaceEditor(element, url [ , options ] )
    

    The constructor for the Ajax.InPlaceEditor accepts three parameters −

    • The target element can either be a reference to the element itself or the id of the target element.

    • The second parameter to the Ajax.InPlaceEditor specifies the URL of a server-side script that is contacted when an edited value is completed.

    • The usual options hash.

    Options

    You can use one or more of the following options while creating your Ajax.InPlaceEditor object.

    Sr.No Option & Description
    1

    okButton

    A Boolean value indicating whether an "ok" button is to be shown or not. Defaults to true.

    2

    okText

    The text to be placed on the ok button. Defaults to "ok".

    3

    cancelLink

    A Boolean value indicating whether a cancel link should be displayed. Defaults to true.

    4

    cancelText

    The text of the cancel link. Defaults to "cancel".

    5

    savingText

    A text string displayed as the value of the control while the save operation (the request initiated by clicking the ok button) is processing. Defaults to "Saving".

    6

    clickToEditText

    The text string that appears as the control "tooltip" upon mouse-over.

    7

    rows

    The number of rows to appear when the edit control is active. Any number greater than 1 causes a text area element to be used rather than a text field element. Defaults to 1.

    8

    cols

    The number of columns when in active mode. If omitted, no column limit is imposed.

    9

    size

    Same as cols but only applies when rows is 1.

    10

    highlightcolor

    The color to apply to the background of the text element upon mouse-over. Defaults to a pale yellow.

    11

    highlightendcolor

    The color to which the highlight color fades to as an effect.

    Note − support seems to be spotty in some browsers.

    12

    loadingText

    The text to appear within the control during a load operation. The default is "Loading".

    13

    loadTextURL

    Specifies the URL of a server-side resource to be contacted in order to load the initial value of the editor when it enters active mode. By default, no backend load operation takes place and the initial value is the text of the target element.

    14

    externalControl

    An element that is to serve as an "external control" that triggers placing the editor into an active mode. This is useful if you want another button or other element to trigger editing the control.

    15

    ajaxOptions

    A hash object that will be passed to the underlying Prototype Ajax object to use as its options hash.

    Callback Options

    Additionally, you can use any of the following callback functions in the options parameter

    Sr.No Function & Description
    1

    onComplete

    A JavaScript function that is called upon successful completion of the save request. The default applies a highlight effect to the editor.

    2

    onFailure

    A JavaScript function that is called upon failure of the save request. The default issues an alert showing the failure message.

    3

    callback

    A JavaScript function that is called just prior to submitting the save request in order to obtain the query string to be sent to the request. The default function returns a query string equating the query parameter "value" to the value in the text control.

    CSS Styling and DOM id Options

    You can also use one the following options to control the behavior of in place editor −

    Sr.No Option & Description
    1

    savingClassName

    The CSS class name applied to the element while the save operation is in progress. This class is applied when the request to the saving URL is made, and is removed when the response is returned. The default value is "inplaceeditor-saving".

    2

    formClassName

    The CSS class name applied to the form created to contain the editor element. Defaults to "inplaceeditor-form".

    3

    formId

    The id applied to the form created to contain the editor element.

    Example

    Live Demo
    
       
          </span><span class="pln">Simple Ajax Auto-completer Example</span><span class="tag">
    		
          
          
          
          
       
       
       
          

    Click over the "Click me!" text and then change text and click OK.

    Try this example with different options.

    id = "theElement"> Click me!

    When displayed, click and edit the text. This rather trivial PHP script converts the value of a query parameter with the key "value" to its uppercase equivalent, and writes the result back to the response.

    Here is the content of transform.php script.

    php
       if( isset($_REQUEST["value"]) ) {
          $str = $_REQUEST["value"];
          $str = strtoupper($str);
          echo "$str";
       }
    ?>

    This will produce following result −

    The In-Place Collection Editor Options

    There is one more object called Ajax.InPlaceCollectionEditor, which supports in-place editing and gives you the option to select a value from the given options.

    The whole construction syntax is as follows −

    new Ajax.InPlaceCollectionEditor(element, url [ , options ] )
    

    The constructor for the Ajax.InPlaceCollectionEditor accepts three parameters −

    • The target element can either be a reference to the element itself or the id of the target element

    • The second parameter to the Ajax.InPlaceEditor specifies the URL of a server-side script that is contacted when an edited value is completed.

    • The usual options hash.

    Options

    Aside from the addition of the collection option, the list of options for the In-Place Collection Editor is a subset of the options inherited from the In-Place Text Editor.

    Sr.No Option & Description
    1

    okButton

    A Boolean value indicating whether an "ok" button is to be shown or not. Defaults to true.

    2

    okText

    The text to be placed on the ok button. Defaults to "ok".

    3

    cancelLink

    A Boolean value indicating whether a cancel link should be displayed. Defaults to true.

    4

    cancelText

    The text of the cancel link. Defaults to "cancel".

    5

    savingText

    A text string displayed as the value of the control while the save operation (the request initiated by clicking the ok button) is processing. Defaults to "Saving".

    6

    clickToEditText

    The text string that appears as the control "tooltip" upon mouse-over.

    7

    Highlightcolor

    The color to apply to the background of the text element upon mouse-over. Defaults to a pale yellow.

    8

    Highlightendcolor

    The color to which the highlight color fades to as an effect.

    Note − support seems to be spotty in some browsers.

    9

    Collection

    An array of items that are to be used to populate the select element options.

    10

    loadTextUrl

    Specifies the URL of a server-side resource to be contacted in order to load the initial value of the editor when it enters active mode. By default, no backend load operation takes place and the initial value is the text of the target element. In order for this option to be meaningful, it must return one of the items provided in the collection option to be set as the initial value of the select element.

    11

    externalControl

    An element that is to serve as an "external control" that triggers placing the editor into active mode. This is useful if you want another button or other element to trigger editing the control.

    12

    ajaxOptions

    A hash object that will be passed to the underlying Prototype Ajax object to use as its options hash.

    Callback Options

    Additionally, you can use any of the following callback functions in the options parameter −

    Sr.No Function & Description
    1

    onComplete

    A JavaScript function that is called upon successful completion of the save request. The default applies a highlight effect to the editor.

    2

    onFailure

    A JavaScript function that is called upon failure of the save request. The default issues an alert showing the failure message.

    CSS Styling and DOM id Options

    You can also use one the following options to control the behavior of in-place editor −

    Sr.No Option & Description
    1

    savingClassName

    The CSS class name applied to the element while the save operation is in progress. This class is applied when the request to the saving URL is made, and is removed when the response is returned. The default value is "inplaceeditor-saving".

    2

    formClassName

    The CSS class name applied to the form created to contain the editor element. Defaults to "inplaceeditor-form".

    3

    formId

    The id applied to the form created to contain the editor element.

    Example

    Live Demo
    
       
          </span><span class="pln">Simple Ajax Auto-completer Example</span><span class="tag">
    		
          
          
          
          
       
       
       
          

    Click over the "Click me!" text and then change text and click OK.

    Try this example with different options.

    id = "theElement"> Click me!

    Here is the content of the transform.php script.

    php
       if( isset($_REQUEST["value"]) ) {
          $str = $_REQUEST["value"];
          $str = strtoupper($str);
          echo "$str";
       }
    ?>

    When displayed, click and select one of the displayed options. This rather trivial PHP script converts the value of the query parameter with the key "value" to its uppercase equivalent, and writes the result back to the response.

    Use our online compiler for a better understanding of the code with different options discussed in the above table.

What are the most expensive skills for freelancing?

posted on June 11, 2021

tags:

Highest Paying Freelancing Skills

1. Programming And Software Development

Programming jobs, especially software and mobile app development, pays the highest for freelancers. Only because it’s a skill that’s quite difficult to master and there aren’t many good coders out there. So, the demand for good coders is pretty high.

If you want to make an income like James, start learning to code. And I don’t mean learning through free courses on CodeAcademy or Udemy. They’ll only take you through the basics. You’ll need to invest some money and time into learning and practicing to develop proper coding skills.

Of course, you won’t be able to start charging $1,000 an hour right away. You’ll have to gradually build up your reputation. If you have solid skills in programming languages like iOS and WebGL, you could start charging somewhere around $150 per hour, or more.

According to a recent UpWork survey, Bitcoin developers also have high demand. Most Bitcoin developers earn over $200 per hour.

2. Social Video Marketing

In a surprise turn of events, a new skill is born—”social video marketing”. The skill ranked at the third place of the UpWork’s Q2 2019 fastest-growing skills list. And for good reason as well.

A quick search on the platform showed that this skill pays over $150 per hour for marketers.

It’s no surprise that this skill is in high demand. Especially given the rise of video content marketing. The booming social media channels such as TikTok, Instagram video, and YouTube, will keep this skill relevant for years to come.

If you’re skilled at creating video content, optimizing them for SEO, capturing audiences with new ideas and marketing strategies, this skill will help bring many gigs your way.

3. Web Design And Development

According to an UpWork statistics report, PHP Development is the most in-demand skill of 2015. Web Design ranks at the 7th spot.

There’s great demand for web designers. But, it’s worth noting that the freelance web design industry is pretty crowded right now because it’s easy to learn web design and start coding websites. Heck, even I did some web design work for a while and started my own web design agency. Spoiler alert! It didn’t go so well.

The best strategy would be to find a niche in the field. For example, Jonathan Wold made over $5,000 a month by building websites with WordPress and doing small theme customizations. You’ll probably be able to earn more if you offer the right kind of services to the right clients.

4. Content Marketing/Writing

Thanks to the boom in online marketing trends and the development of new methodologies, like Inbound Marketing, content writing is now considered as one of hottest fields for freelancers.

You don’t need to go anywhere to find proof of how well freelance writers are doing. Take me for example. Right now, I make around $5,000 a month (at least in most months) doing blogging work for businesses, writing, and content marketing work. And I know there are other freelance writers who do much better than me.

Although, not everyone can be a skilled writer. You need to write a lot, read a lot, and, more importantly, you’ll need a creative mind to write amazing articles that pay well. Your master’s degree in literature and the A+ essay skills from college won’t do you any good when working online either.

5. Graphic Design

Graphic design ranks at number 2 on the UpWork’s most in-demand skills list. And if you look at its top freelancers under the graphic design category, you’ll see some freelancers who make up to $85 per hour doing design work.

Infographic design has higher demand these days. Logo design, icon design, and illustrations pay pretty well too. But, like with content writing, to become a quality graphic designer, you’ll need to develop an eye for design.

6. Copywriters

Copywriters are different from content marketers and writers. These freelancers specialize in writing content for website pages, descriptions for products, services, etc.

The charge rates for copywriters depend on each freelancer’s level of experience and skill. Linda Formichelli, an experienced freelance copywriter, makes $250 per hour.

If you look at UpWork’s list of top copywriters, you’ll notice that they charge between $15 per hour to $100 per hour for copywriting jobs.

7. Video Editors

Freelance video editors in the US earns around $72,000 per year, while more experienced video editors make around $122,000 per year.

The demand for video editors in the freelance industry saw a rise in the last few years, thanks to the opportunities presented by platforms such as YouTube, Facebook, and Instagram.

If you’re good with putting together video clips and creating awesome video content, this could be a great future-proof career to get into.

Sencha Touch Tutorial

posted on June 9, 2021

tags:

Sencha Touch is a popular framework of Sencha for creating a user interface for mobile applications. It helps the developer create a mobile app using simple HTML, CSS, JS which supports many mobile devices such as android, IOS, BlackBerry, and Windows. It is based on MVC architecture. The latest version of Sencha Touch is 2.4.

History of Sencha Touch

After releasing Sencha's other product, ExtJs, which was for web application, there was a need to develop a framework which works on mobile devices too.

The first version of Sencha Touch was 0.9 beta version, which supported Android and IOS devices. Later, the first main release of Sencha Touch version 1.0 was in November 2010, which was the first stable version and supported Blackberry devices too.

The latest release of Sencha Touch is version 2.4 released in June 2015, which supports many devices such as Windows, Tizen along with Android, IOS, BlackBerry OS 10, Google Chrome for Android and mobile Safari, etc.

Features of Sencha Touch

Following are the most prominent features of Sencha Touch −

  • Customizable and more than 50 build in UI widgets with a collection of rich UI such as lists, carousels, forms, menus, and toolbars, built specifically for mobile platforms.

  • Code compatibility of new versions with the older one.

  • A flexible layout manager that helps organize the display of data and content across multiple mobile devices with different OS.

  • The framework includes a robust data package that can consume data from any backend data source.

  • Adaptive layouts, animations, and smooth scrolling for a better mobile web application experience for the use.

  • Out-of-the-box, native-looking themes for every major platform enables to make web and hybrid applications match the look and feel of the target platforms.

Sencha Touch ââ€â‚¬ Benefits

Sencha Touch is the leading standard for business-grade web application development. It offers the tools necessary to build robust applications for most of the mobile devices providing a single platform for developing applications. Following are some of the benefits −

  • Provides a responsive touch feature, hence the user can easily navigate while using the mobile app.

  • Provides compatibility with all the latest versions of IOS, Android and Blackberry, and Windows.

  • Provides fastest possible speed desirable for any mobile application.

  • Provides a cost-effective solution with its cross-platform compatibility.

  • Based on the native APIs and basic web development languages such as HTML, CSS, JS which makes it easier for a developer to understand Sencha Touch.

Sencha Touch ââ€â‚¬ Limitations

Sencha Touch API doesn't have the following capability −

  • The app does not have access to the device’s camera, contacts, and accelerometer.

  • It does not provide the push notification facility. For this, we have to use websockets or long polling.

  • According to general public license policy, it is free for open source applications however paid for commercial applications.

  • It is not good for hardcore graphics and animation apps such as for gaming apps.

Sencha Touch ââ€â‚¬ Tools

Sencha SDK

This is Sencha development kit used to create a skeleton of the project. We use the command "sencha -sdk path/to/touch generate app appName" to create an app with the name given in the command.

When the app is created, you can see the following files in the app −

  • app − This folder contains model, view, controller and store files for the app.

  • app.js − This is the main JS file for your application. From this file, the Sencha code flow starts.

  • app.json − This is the configuration file for the app, all the configuration details presents here.

  • index.html − This is the main html file where we include the app.js and other Sencha related files.

  • package.json − This file has all the dependency and other information related to the app.

  • resources − This folder includes all the CSS files and images required for the application.

Sencha CMD

Sencha CMD is a command line tool, which provides the features of Sencha Touch code minification, scaffolding, build generation, and other useful features for production purpose.

We use command "Sencha app build package" in the command prompt to build the application for this. Go to the app directory in the command prompt and type the above command. Once the build is successful, we will see the minified version of the application basically used for production purpose.

This can be downloaded from https://www.sencha.com/products/extjs/cmd-download/

Sencha Inspector

Sencha Inspector is a debugging tool to debug any issue in Sencha code during development.

Sencha Touch - Environment Setup

We have set up Sencha Touch Programming environment online, so that you can compile and execute all the available examples online. It gives you confidence in what you are reading and enables you to verify the programs with different options. Feel free to modify any example and execute it online.

<!DOCTYPE html>
<html>
   <head>
      <link href="http://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel="stylesheet" />
      <script type="text/javascript" src="http://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type="text/javascript">
        Ext.application({
           name: 'Sencha',
           launch: function() {
              Ext.create("Ext.tab.Panel", {
                 fullscreen: true,
                 items: [{
                    title: 'Home',
                    iconCls: 'home',
                    html: 'Welcome'
                 }]
              });
           }
        });
      </script>
   </head>
   <body>
   </body>
</html>

Local Environment Setup

This section guides you on how to download and set up sench Touch on your machine. Please follow the steps to set up the environment.

Downloading library files

Download a commercial version of Sencha Touch library files from sencha https://www.sencha.com. You will get the trial version from the site on your registered mail id which will be a zipped folder named sencha-touch-2.4.2-commercial.

Unzip the folder and you will find various JavaScript and CSS files which you will include in our application. We will mostly include following files:

(1) Javascript Files JS file which you can find under folder sencha-touch-2.4.2-commercial ouch-2.4.2 are :

File and Description
sencha-touch.js
This is the core file which contains all functionality to run the application.
sencha-touch-all.js
This file contains all the code minified with no comments in the file
sencha-touch-debug.js
This is the unminified version of sencha-touch-all.js for debugging purpose.
sencha-touch-all-debug.js
This file is also unminified and is used for development purpose as it contains all the comments and console logs also to check any errors/issue

You can add these files to your projects JS folder or you can give direct path where the file reside in your system.

(2) CSS Files There are number of theme based files which you can find under folder I:sencha touchsencha-touch-2.4.2-commercial ouch-2.4.2 esourcescsssencha-touch.css

These library files will be added in an Sencha Touch application as follows:

<html>
   <head>
    <script type="text/javascript" src="../sencha-touch-2.4.2-commercial/touch-2.4.2/sencha-touch-all.js"></script>  
    <link href="../sencha-touch-2.4.2-commercial/touch-2.4.2/resources/css/sencha-touch.css" rel="stylesheet" />
    <script type ="text/javascript" src = "app.js" > </script> 
   </head>
</html>

You will keep sencha Touch application code in app.js file.

CDN setup

CDN is content delivery network with which you do not need to download the Sencha touch library files instead you can directly add CDN link for ExtJS to your program as follows:

<html>
   <head>
    <script type="text/javascript" src="http://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>    
    <link href="http://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel="stylesheet" />
    <script type ="text/javascript" src = "app.js" > </script> 
   </head>
</html>

Popular Editors

As it is a JavaScript framework which is used for developing web applications, in our project we will have HTML, JS files and to write your Ext JS programs, you will need a text editor. There are even multiple IDEs available in the market. But for now, you can consider one of the following:

  • Notepad: On Windows machine you can use any simple text editor like Notepad (Recommended for this tutorial), Notepad++.
  • Brackets: is another popular IDE which can be downloaded from http://brackets.io/ .
  • Sublime: is another popular IDE which can be downloaded from https://www.sublimetext.com/3/ .

Sencha Touch - Naming Convention

Naming convention is a set of rules to be followed for identifiers. It makes the code easily readable and understandable for other programmers as well.

Naming convention in Sencha Touch follows the standard JavaScript convention, which is not mandatory but a good practice to follow. It should follow camel case syntax for naming the class, method, variable, and properties.

If the name is combined with two words, the second word will start with an uppercase letter always. For example, doLayout(), StudentForm, firstName, etc.

Sr.No. Name & Convention
1

Class Name

It should start with an uppercase letter, followed by camel case. For example, StudentClass

2

Method Name

It should start with a lowercase letter, followed by camel case. For example, studentMethod()

3

Variable Name

It should start with a lowercase letter, followed by camel case. For example, studentName

4

Constant Name

It should be in uppercase only. For example, COUNT, MAX_VALUE

5

Property Name

It should start with a lowercase letter, followed by camel case. For example, enableColumnResize = true

Sencha Touch - Architecture

The bottom layer for any mobile application is OS, on top of that anything or everything is built. Then we have the browsers on which we will be running the applications. It could be Chrome, Safari, IE anything. The upper layer is a W3 standards, which is common for all. Sencha Touch stands or is built on top of W3 standards, which is nothing but HTML5, which makes a single application compatible with different browsers of different devices.

Sencha Touch is a combination of three frameworks − ExtJs, JqTouch, and Raphael (vector drawing). It follows MVC architecture. MVC separates the code into more manageable chunks.

Although the architecture is not mandatory for the program, however, it is a best practice to follow this structure to make your code highly maintainable and organized.

Project Structure With Sencha Touch App

----------src
----------resources
-------------------CSS files
-------------------Images
----------JavaScript
--------------------App Folder
-------------------------------Controller
------------------------------------Contoller.js
-------------------------------Model
------------------------------------Model.js
-------------------------------Store
------------------------------------Store.js
-------------------------------View
------------------------------------View.js
-------------------------------Utils
------------------------------------Utils.js
--------------------------------app.js
-----------HTML files

Sencha Touch app folder will reside in the JavaScript folder of your project.

The App will contain controller, view, model, store, and utility files with app.js.

app.js − The main file from where the flow of program will start. It should be included in main HTML file using <script> tag. App calls the controller of application for rest of the functionality.

Controller.js − It is the controller file of Sencha Touch MVC architecture. This contains all the control of the application, the events listeners, and most of the functionality of the code. It performs the following tasks: routing, intermediate between view and model, and executes events.

View.js − It contains the interface part of the application, which shows up to the user. Sencha Touch uses various UI rich views, which can be extended and customized according to the requirement.

Store.js − It contains the locally cached data, which is to be rendered on view with the help of model objects. Store fetches the data using proxies, which has the path defined for services to fetch the backend data.

Model.js − It contains the objects which binds the store data to view. It is the representation of the real-world object, which basically deals with the database.

Utils.js − It is not included in MVC architecture but it is a best practice to use this so as to make the code clean, less complex, and more readable. We can write methods in this file and call them in controller or view renderer wherever required. It is helpful for code reusability purpose as well.

Sencha Touch - MVC

MVC stands for Model View Controller. It is an architectural pattern which separates the application into logical components making it more manageable.

The following diagram shows how MVC architecture works −

MVC

Controller − Controller controls whole application it notify view if model is changed and performs actions based on user inputs.

View − It contains the interface part of the application which is visual to user. It notify controller to change model on user input.

Model − It contains the objects which binds the store data to view. It is representation of the real world object which basically deals with database. It also notify controller for any change in view.

Sencha Touch - First Program

In this chapter, we will list down the steps to write the first Hello World program in Ext JS.

Step 1

Create an index.htm page in an editor of our choice. Include the required library files in the head section of html page as follows.

index.htm

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js">
      </script>
      <script type = "text/javascript">
         Ext.application( {
            name: 'Sencha', launch: function() {
               Ext.create("Ext.tab.Panel", {
                  fullscreen: true, items: [{
                     title: 'Home', iconCls: 'home', html: 'Welcome to sencha touch'
                  }]
               });
            }
         });
      </script>
   </head>
   
   <body>
   </body>
</html>

Explanation

  • Ext.application() method is the starting point of Sencha Touch application. It creates a global variable called 'Sencha' declared with the name property - all the Application's classes such as its Models, Views and Controllers will reside under this single namespace, which reduces the chances of colliding global variables and file names.

  • launch() method is called once the page is ready and all the JavaScript files are loaded.

  • Ext.create() method is used to create an object in Sencha Touch. Here, we are creating an object of simple panel class Ext.tab.Panel.

  • Ext.tab.Panel is the predefined class in Sencha Touch for creating a panel.

  • Every Sencha Touch class has different properties to perform some basic functionalities.

Ext.Panel class has various properties such as −

  • fullscreen property is to make use of a complete screen, hence the panel will take fullscreen space.

  • items property is the container for various items.

  • iconCls is the class used for displaying different icons.

  • title property is to provide the title to the panel.

  • html property is the html content to be shown in the panel.

Step 2

Open the index.htm file in a standard browser and you will get the following output.

Sencha Touch - Builds

Today's demand for a web application is to develop a fast application with less development efforts. Sencha Touch helps in doing so with ease as it provide a number of build libraries to choose from, based on the development or production code along with the facility to create a custom build.

Sencha Touch build libraries loads the classes dynamically. Dynamic loading stands for the classes that gets loaded when required and only those classes will be included which are required in the application. This makes the application run faster as the number of files to be loaded reduces, simultaneously decreasing the time to load.

Sencha Touch 2.x provides the following five build libraries.

Sr.No. Builds & Usage
1

sencha-touchdebug.js

This build is used while developing the application locally. It is a nonminified version with all the comments and debug logs for easy debugging while development.

2

senchatouch.js

This file is used for production purpose. It is the minified version when we have a custom build.

3

sencha-touchall.js

This file is used for production purpose. It is the minified version when we do not have a custom build.

4

sencha-touchall-debug.js

This file is used for debugging in production. It is not minified and has all the comments and debug logs.

5

sencha-touchall-compat.js

This build is used to migrate the version 1.x to version 2.x. It gives a warning wherever version 1.x code is not compatible and needs code modification.

With the above mentioned builds, Sencha Touch provides a facility to create custom builds.

Advantages of Having a Custom Build

Custom build does not load all the touch files. It loads only those files, which we are using in the application, which makes the application faster and easily maintainable.

Sencha CMD is used to create a custom build. To create a custom build in Sencha CMD, go to the directory where the app file resides and type one of the following commands to create a build.

Sr.No. Command & Usage
1

sencha app build native

Builds the app and prepares a file called packager.temp.json that you can use to package an application--the packager.temp.json is the same as packager.json, but contains additional paths.

2

sencha app build -run native

Builds and automatically packages the application, and launches the appropriate simulator.

3

sencha app build package

Builds the app with packaging support, but does not configure a packager JSON file. This is useful for projects that manually maintain multiple packager.json files.

Once the build is successful, it will generate all-classes.js file which we need to include in our index.html to make it production ready.

Following code shows the changes to be done for production ready code.

Index.html before building application

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-debug.js"></script>
      <script type = "text/javascript" src = "app.js"> </script>
   </head>
   <body>
   </body>
</html>

Index.html after building the application

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch.js"></script>
      <script type = "text/javascript" src = "app.js"> </script>
      <script type = "text/javascript" src = "app-classes.js"> </script>
   </head>
   <body>
   </body>
</html>

Sencha Touch - Migration

Sencha Touch comes with various rectifications from the earlier version.

Sencha Touch 2 comes with the backward compatibility build, which makes the migration process easier from version 1.x to 2.x.

This build just makes the work easier by providing a warning and the logs whenever any migration issue occurs or code change is required, so the user will get to know where the changes are must, to make sure the application works with the latest version.

Sencha Touch 2.x migration requires the following code changes.

Class System

Code in Sencha Touch 1.x

MyApp.view.StudentPanel = Ext.extend(Ext.Panel, {
   scroll: 'vertical',
   html: 'Student Panel'
   initComponent: function() {
      Ext.getCmp('StudentIdDiv').update('This is a Student panel');
   }
});

Code in Sencha Touch 2.x

Ext.define('MyApp.view.StudentPanel', {
   extend: 'Ext.Panel',

   config: {
      scroll: 'vertical',
      html: 'Student Panel'
   },

   initialize: function() {
      Ext.getCmp('StudentIdDiv').setHtml('This is a Student panel')
   }
});

By looking at both the versions, you can see the way to create class is changes which is now inspired by ExtJs such as −

  • Ext.extend is changed to Ext.define.

  • All the configuration parameters related to the class are now defined under config parameter.

  • The initComponent is changed to initialize() method.

  • In Sencha Touch 2.x, we can have setHtml() and getHtml() functions to update html or to get the value.

MVC Architecture

Sencha Touch 1.x code was modular and based on MVC architecture. Sencha Touch 2.x follows a different syntax for writing model, view, and controller. Let’s see the difference of model, view, and controller files in different versions.

Model

Code in Sencha Touch 1.x

Ext.regModel('MyApp.model.StudentModel', {
   fields: [
      {name: 'name',  type: 'string'},
      {name: 'age',   type: 'int'}
   ]
});

Code in Sencha Touch 2.x

Ext.define('MyApp.model.StudentModel', {
   extend: 'Ext.data.Model', config: {
      fields: [
         {name: 'name',  type: 'string'},
         {name: 'age',   type: 'int'}
      ]
   }
});

Ext.regModel is changed to Ext.define which extends Ext.data.Model.

All the fields come under config section now in 2.x version.

View

Code in Sencha Touch 1.x

Ext.Panel("studentView", {
   items: [{}]
});

Code in Sencha Touch 2.x

Ext.define('MyApp.view.StudentView', {
   extend: 'Ext.tab.Panel',
   items: [{}]
});  

View is almost the same, the only change being the view name follows the 2.x version namespacing such as Myapp.view.StudentView and code is writing in Ext.define method as like model.

Controller

Code in Sencha Touch 1.x

Ext.regController("studentController", {
   someMethod: function() {
      alert('Method is called');
   }
});

Code in Sencha Touch 2.x

Ext.define('MyApp.controller.studentController', {
   extend: 'Ext.app.Controller', someMethod: function() {
      alert('Method is called');
   }
});

Same as model in controller. Also the Ext.regController is changed into Ext.define, which extends Ext.app.Controller.

Application

Code in Sencha Touch 1.x

Ext.application({
   name: 'MyApp',
   launch: function() {
      Ext.create('MyApp.view.StudentView');
   }
});

Code in Sencha Touch 2.x

Ext.application({
   name: 'MyApp',
   models: ['studentModel'],
   controllers: ['studentController'],
   views: ['studentView'],
   stores: ['studentStore'],

   launch: function() {
      Ext.create('MyApp.view.Main');
   }
});

The major difference between version 1.x and version 2.x is, in 2.x we declare all model, views, controllers, and stores in the application itself.

Sencha Touch - Core Concept

Sencha Touch has various core concepts such as class system, ajax, controllers, etc.

Following table lists the link for core concepts of Sencha Touch.

Sr.No. Concept & Description Link
1 Class System
2 Components
3 Controllers
4 BlackBerry support
5 Use of Ajax

Sencha Touch - Data Package

Data package in Sencha Touch is responsible for carrying out any kind of data manipulation either storing or loading the data.

Data packages are related to model, store, and proxies.

Sr.No. Concept & Description Link
1

Model

It is the collection of data and fields with which we display all the values on UI. Description

2

Store

It is a collection of model instances which basically stores the data locally. In store we write all the events and rest calls to get data. Description

3

Proxy

It is basically responsible for loading data in store. Mostly we use ajax proxy to load store data. Description

Sencha Touch - Theme

Sencha Touch provides a number of themes to be used in your applications. You can add different themes in place of classic theme and see the difference in the output based on the device we are using for the application. This is done simply by replacing the theme CSS file as explained in the following example.

Desktop Theme

Consider your very first Hello World application. The following CSS from the application is used for desktop theme.

https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css

To see the effect, try the following program −

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type="text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.application({
            name: 'Sencha',
            launch: function() {
               Ext.create("Ext.tab.Panel", {
                  fullscreen: true,
                  items: [{
                     title: 'Home',
                     iconCls: 'home',
                     html: 'Welcome to sencha touch'
                  }]
               });
            }
         });
      </script>
   </head>
</html>

This will produce following result −

Windows Theme

Consider your very first Hello World application. Remove the following CSS from the application −

https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css

Add the following CSS to use Windows theme.

https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/wp.css

To see the effect, try the following program −

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/wp.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.application({
            name: 'Sencha',
            launch: function() {
               Ext.create("Ext.tab.Panel", {
                  fullscreen: true,
                  items: [{
                     title: 'Home',
                     iconCls: 'home',
                     html: 'Welcome to sencha touch'
                  }]
               });
            }
         });
      </script>
   </head>
</html>

This will produce following result −

IOS Theme

Consider your very first Hello World application. Remove the following CSS from the application.

https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css

Add the following CSS to use Windows theme

https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/cupertino.css

To see the effect, try the following program −

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/cupertino.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.application({
            name: 'Sencha',
            launch: function() {
               Ext.create("Ext.tab.Panel", {
                  fullscreen: true,
                  items: [{
                     title: 'Home',
                     iconCls: 'home',
                     html: 'Welcome to sencha touch'
                  }]
               });
            }
         });
      </script>
   </head>
</html>

This will produce following result −

IOS Classic Theme

Consider your very first Hello World application. Remove the following CSS from the application −

https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css

Add the following CSS to use Windows theme −

https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/cupertino-classic.css

To see the effect, try the following program −

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/cupertino-classic.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.application({
            name: 'Sencha',
            launch: function() {
               Ext.create("Ext.tab.Panel", {
                  fullscreen: true,
                  items: [{
                     title: 'Home',
                     iconCls: 'home',
                     html: 'Welcome to sencha touch'
                  }]
               });
            }
         });
      </script>
   </head>
</html>

This will produce following result −

Android Theme

Consider your very first Hello World application. Remove the following CSS from the application.

https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css

Add the following CSS to use Windows theme.

https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/mountainview.css

To see the effect, try the following program −

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/mountainview.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.application({
            name: 'Sencha',
            launch: function() {
               Ext.create("Ext.tab.Panel", {
                  fullscreen: true,
                  items: [{
                     title: 'Home',
                     iconCls: 'home',
                     html: 'Welcome to sencha touch'
                  }]
               });
            }
         });
      </script>
   </head>
</html>

This will produce following result −

BlackBerry Theme

Consider your very first Hello World application. Remove the following CSS from the application.

https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css

Add the following CSS to use Windows theme.

https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/bb10.css

To see the effect, try the following program −

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/bb10.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.application({
            name: 'Sencha',
            launch: function() {
               Ext.create("Ext.tab.Panel", {
                  fullscreen: true,
                  items: [{
                     title: 'Home',
                     iconCls: 'home',
                     html: 'Welcome to sencha touch'
                  }]
               });
            }
         });
      </script>
   </head>
</html>

This will produce following result −

Sencha Touch - Device Profile

In today's world of technologies, we have multiple devices such as mobile, tablet, desktop, and laptop with different screen sizes. Hence, there is a need to develop applications, which are accessible from all the devices with good look and feel. However, to develop different code for different devices is very time consuming and costly.

Sencha Touch helps us in this regard, by offering a device profile feature. Based on the active profile, the different dependencies will be run and applicable.

We can declare device profile while writing an application code. We can have multiple devices as −

Ext.application({
   name: 'MyApp',
   profiles: ['Phone', 'Tablet']
});

Once it is done, the profiles will be loaded as −

  • MyApp.profiles.Phone.js
  • MyApp.profiles.Tablet.js

Writing a simple phone profile

Ext.define('Mail.profile.Phone', {
   extend: 'Ext.app.Profile',

   config: {
      name: 'Phone',
      views: ['phoneView']
   },

   isActive: function() {
      return Ext.os.is('Phone');
   }
});

Writing a simple tablet profile

Ext.define('Mail.profile.Tablet', {
   extend: 'Ext.app.Profile',

   config: {
      name: 'Tablet',
      views: ['tableView']
   },

   isActive: function() {
      return Ext.os.is('Tablet');
   }
});

As we can see in profile, we have isActive function which determines if the particular device is active. If the device is active, the corresponding dependencies will be loaded and instantiated.

As mentioned in the above example, if we are using phone device then phone profile's isActive function will return true and the dependencies related to the phone device will be loaded; here phoneView will be loaded. If the device is a tablet then phone profile's isActive function will return false and tablet profile's isActive function will return true and dependency tabletView will be loaded.

Launch Process

One more point to be noticed here is when we have profiles in the application, then the loading and instantiation of application code will be in the following order −

  • Controllers are instantiated first and each controller's init function will be loaded.
  • Profile's launch function will be called.
  • Application's launch function will be called.

Both profile and application's launch functions are optional, so if we do not define any one of them they will not get called.

Take a look at the following code to check where and how the different launch and init functions can be defined.

Controller's init function

Ext.define('MyApp.controller.Main', {
   extend: 'Ext.app.Controller',
   
   init : function (){
      Ext.Msg.alert('Controller's init method');
   },
   
   config: {
      refs: {
         tab: '#divId
     }
   }
});

Profile's launch function

Ext.define('Mail.profile.Tablet', {
   extend: 'Ext.app.Profile',

   config: {
      name: 'Tablet', views: ['tableView']
   },

   isActive: function() {
      return Ext.os.is('Tablet');
   }
   launch : function() {
      Ext.Msg.alert('profile's launch function');
   }
});

Application's launch function

Ext.application({
   name: 'Sencha', launch: function() {
      Ext.Msg.alert(Application's launch function);
   }
});

Sencha Touch - Dependencies

There are certain ways defined in Sencha Touch to declare dependencies, one within the application and the other inside the classes.

Let’s take a look at the different ways to define dependencies.

Application Level Dependencies

Here, we declare all the dependencies when we create Ext.application.

Ext.application({
   name: 'MyApp',
   views: ['StudentsView'],
   models: ['StudentsModel'],
   controllers: ['StudentsController'],
   stores: ['StudentsStore'],
   profiles: ['Phone', 'Tablet']
});

Now, when the application gets loaded, all the dependencies will be loaded at the same time. The path of the other files will be −

  • MyApp.views.StudentsView
  • MyApp.models.StudentsModel
  • MyApp.stores.StudentsStore etc.

The above way of declaration not only loads the file, it also decides which profile it should keep as active. After loading the controller, it makes sure to instantiate it. Once the stores are loaded, it instantiates them and provides one id if not already given.

Profile-specific Dependencies

When we are using profiles in an application, there may be possibilities that few functionalities are only required for some specific profile.

Profile specific dependencies are declared in the profiles itself instead of the application level declaration.

Ext.define('MyApp.profile.Tablet', {
   extend: 'Ext.app.Profile', config: {
      views: ['StudentView'], controllers: ['StudentController'], models: ['StudentModel']
   }
});

Dependencies get loaded irrespective of the profile being active or not. However, based on the active profile, further processing such as instantiating controller and stores happens.

Nested Dependencies

When we have larger application we have multiple controllers, models, views, and stores.

It is always good to keep modularity in larger applications. For that, we can define subfolders and while declaring dependencies we can use subfolder name to declare.

Ext.application({
   name: 'MyApp',
   controllers: ['Controller', 'nested.NewController'],
   views: ['class.Cview', 'SView']
});

In the above case, following files will be loaded −

  • MyApp.controllers.Controller
  • MyApp.controllers.nested.NewController
  • MyApp.Views.Sview
  • MyApp.Views.class.Cview

External Dependencies

We can specify the dependencies outside the application by giving fully qualified names of the classes as −

Ext.Loader.setPath({
   'Class': 'Class'
});

Ext.application({
   views: ['Class.view.LoginForm', 'Welcome'],
   controllers: ['Class.controller.Sessions', 'Main'],
   models: ['Class.model.User']
});

In the above case, following files will be loaded −

  • Class/view/LoginForm.js
  • Class/controller/Sessions.js
  • Class/model/User.js
  • app/view/Welcome.js
  • app/controller/Main.js

Sencha Touch - Environment Detection

It helps you in identifying which operating system you are using, which browser you are working on, and what are the features available for your environment.

Sencha Touch provides different functions to get information specific to the environment. All the methods mentioned below can be checked in, if the condition is if(Ext.os.is.Windows){} and is based on the condition tasks can be performed.

All the following methods return Boolean value.

Operating System

Ext.os is a class that gives you different methods to know which operating system we are working on.

Sr.No Method & Description
1

Ext.os.is.webOS

This function will return true if you are using webos operating system else it returns false.

2

Ext.os.is.RIMTable

This function will return true if you are using RIMTable operating system else it returns false.

3

Ext.os.is.Linux

This function will return true if you are using Linux operating system else it returns false.

4

Ext.os.is.Windows

This function will return true if you are using windows operating system else it returns false.

5

Ext.os.is.MacOs

This function will return true if you are using Mac operating system else it returns false.

6

Ext.os.is.BlackBerry

This function will return true if you are using BlackBerry operating system else it returns false.

7

Ext.os.is.iOS

This function will return true if you are using IOS operating system else it returns false.

8

Ext.os.is.Android

This function will return true if you are using Android operating system else it returns false.

Device Detection

Sr.No Method & Description
1

Ext.os.is.iPad

This function will return true if you are using iPad else it returns false.

2

Ext.os.is.iPhone

This function will return true if you are using iPhone else it returns false.

3

Ext.os.is.iPod

This function will return true if you are using iPod else it returns false.

Version of Operating System

Sr.No Method & Description
1

Ext.os.name

It returns the name of the operating system.

2

Ext.os.version.version

It gives the version of operating system we are using.

Browser Detection

Sr.No Method & Description
1

Ext.browser.is.IE

This function returns true if we are using Internet explorer browser else it returns false.

2

Ext.browser.is.FF

This function returns true if we are using FireFox browser else it returns false.

3

Ext.browser.is.Chrome

This function returns true if we are using Chrome browser else it returns false.

4

Ext.browser.is.Opera

This function returns true if we are using Opera browser else it returns false.
5

Ext.browser.is.Safari

This function returns true if we are using Safari browser else it returns false.

This function Ext.browser provides various other functions −

Sr.No Method & Description
1

Ext.browser.userAgent

It returns the current userAgent.

2

Ext.browser.isSecure

It returns true if the current page is using SSL.

3

Ext.browser.isStrict

It returns true if the browser is in strict mode.

4

Ext.browser.engineName

It returns the browser engine name (WebKit, Gecko, Presto, Trident and Other).

5

Ext.browser.engineVersion

It returns the version of the browser engine.

Features

Ext.feature.has is to check if the browser has following feature or not.

Sr.No Method & Description
1

Ext.feature.has.Audio

This method returns true if browser supports audio tag feature of html5.

2

Ext.feature.has.Canvas

This method returns true if browser supports canvas tag feature of html5.

3

Ext.feature.has.classList

This method returns true if browser supports classlist feature of html5 which is used to add, remove and toggle css classes for the html element.

4

Ext.feature.has.Css3dTransforms

This method returns true if browser supports Css 3d Transform feature of css3.

5

Ext.feature.has.CssAnimations

This method returns true if browser supports animations of css3.

6

Ext.feature.has.CssTransforms

This method returns true if browser supports Css transform feature of css3.

7

Ext.feature.has.CssTransitions

This method returns true if browser supports transition feature of css3.

8

Ext.feature.has.DeviceMotion

This method returns true if browser supports the device motion feature.

9

Ext.feature.has.Geolocation

This method returns true if browser supports the Geolocation feature of html5.

10

Ext.feature.has.History

This method returns true if browser Supports history feature of html.

11

Ext.feature.has.Orientation

This method returns true if browser can detect which the device orientation.

12

Ext.feature.has.OrientationChange

This method returns true if browser can detect change in Orientation of the device.

13

Ext.feature.has.Range

Range is a type of html input tag for range slider element so if browser supports slider this function returns true.

14

Ext.feature.has.SqlDatabase

Web sql database is a web page api for storing data n database on which we can perform query operations. This method returns true if browser supports web Sql Database.

15

Ext.feature.has.Svg

Svg stands for Scalable Vector Graphics this method returns true if browser supports html 5's svg feature.

16

Ext.feature.has.Touch

This method returns true if browser has Touch feature.

17

Ext.feature.has.Video

This method returns true if browser supports html 5 video tags.

18

Ext.feature.has.Vml

Vml stands for vector markup language which is an xml based markup language. So this method returns true if browser has supports vml.

19

Ext.feature.has.WebSockets

Web socket is basically a communication protocol for computers which supports two communication between clients and server. This method returns true if browser Supports WebSockets else it returns false.

Sencha Touch - Events

Events are something which get fired when something happens to the class. For example, when a button is getting clicked or before/after an element is rendered.

Methods of Writing Events

Following are the methods of writing events.

  • Built-in events using listeners.
  • Attaching events later
  • Custom events

Built-in Events Using Listeners

Sencha Touch provides listener property for writing events and custom events in Sencha Touch files.

Writing listener in Sencha Touch

We will add the listener in the previous program itself by adding listen property to the panel, shown as follows −

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.application({
            name: 'Sencha', launch: function() {
               Ext.create('Ext.Panel', {
                  html: 'My Panel', fullscreen: true, listeners: {
                     painted: function() {
                        Ext.Msg.alert('I was painted to the screen');
                     }
                  }
               });
            }
         });
      </script> 
   </head>
</html>

This will produce following result −

This way we can also write multiple events in listeners property.

Multiple events in the same listener

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">   
         Ext.application({
            name: 'Sencha',
            launch: function() {
               var myButton = Ext.Viewport.add({
                  xtype: 'button',
                  centered: true,
                  text: 'Click me'
               });

               myButton.on({
                  tap: function() {
                     var randomWidth = 100 + Math.round(Math.random() * 200);
                     this.setWidth(randomWidth);
                  },
                  widthchange: function(button, newWidth, oldWidth) {
                     alert('My width changed from ' + oldWidth + ' to ' + newWidth);
                  }
               });
            }
         });       
      </script> 
   </head>
</html>

It will produce the following result −

Attaching event later

In the previous method of writing events, we have written events in listeners at the time of creating elements.

The other way to attach events is as follows −

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.application({
            name: 'Sencha',
            launch: function() {
               var myButton = Ext.Viewport.add({
                  xtype: 'button',
                  centered: true,
                  text: 'Click me'
               });
               
               myButton.on('tap', function() {
                  alert("Event listener attached by .on");
               });
            }
         });
      </script> 
   </head>
</html>

It will produce the following result −

Custom events

We can write custom events in Sencha Touch and fire the events with fireEvent method. Following example explains how to write custom events.

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.application({
            name: 'Sencha',
            launch: function() {
               var myButton = Ext.Viewport.add({
                  xtype: 'button',
                  centered: true,
                  text: "Just wait 5 seconds",

                  listeners: {
                     myEvent: function(button, points) {
                        alert('myEvent was fired! You score ' + points + ' points');
                     }
                  }
               });

               Ext.defer(function() {
                  var number = Math.ceil(Math.random() * 100);
                  myButton.fireEvent('myEvent', myButton, number);
               }, 5000);
            }
         });
      </script> 
   </head>
</html>

Once the page is loaded and the document is ready, the UI page with button will appear and as we are firing an event after 5 seconds, once the document is ready the alert box will appear after 5 seconds.

Here we have written the custom event 'myEvent' and we are firing events as button.fireEvent(eventName);

Sencha Touch - Layout

Layout is the way the elements are arranged in a container. That could be horizontal, vertical, or any other. Sencha Touch has different layouts defined in its library though we can always write custom layouts as well.

Sr.No. Layout & Description
1 hBox

This layout allows the element to be distributed in a horizontal manner.

2 vBox

This layout allows the element to be distributed in a vertical manner. This is one of the commonly used layout.

3 Fit

In this layout, the container is filled with a single panel and when there is no specific requirement related to the layout, then this layout is used.

4 Card(TabPanel)

This layout arranges different components in tab fashion. Tabs will be displayed on top of the container. Every time only one tab is visible and each tab is considered as a different component.

Sencha Touch - History Support

Sencha Touch comes with full history support and deep linking facilities.

It has the simplest back button functionality, which helps the user navigate between the screens, without even refreshing the page or application.

It also provides routes functionality, which helps the user navigate to any URL. Based on the URL provided in the browser window, it calls specific functions to perform a specific task.

Look at the following example for back button functionality.

This example shows the nested list which is nothing but a list inside a list, so when you click any of the list items, it opens another list and a back button appears on top of the screen.

For complete code base, you can check Nested List under view component section.

Routing

Simplest example of routes

Ext.define('MyApp.controller.Main', {
   extend: 'Ext.app.Controller',

   config: {
      routes: {
         login: 'showLogin',
		 'user/:id': 'userId'
      }
   },

   showLogin: function() {
      Ext.Msg.alert('This is the login page');
   },
   userId: function(id) {
      Ext.Msg.alert('This is the login page specific to the used Id provided');
   }
});

In the above example if browser URL is https://myApp.com/#login then the function showLogin will be called.

We can provide parameters in the URL and based on the specific parameter the function can get called. For example If the URL is https://myApp.com/#user/3 then the another function userId will be called and the specific ID can be used inside the functions.

Advance routing

Sometime we have advance parameters which includes comma, blank space and special characters etc. for this if we use the above way of writing routes then it will not work. To solve this problem Sencha touch provides conditional routing where we can specify condition of what type of data the parameter should accept.

Ext.define('MyApp.controller.Main', {
   extend: 'Ext.app.Controller', config: {
      routes: {
         login/:id: {
            action: showLogin, conditions: {':id: "[0-9a-zA-Z.]+" }      
         }
      },

      showLogin: function() {
         Ext.Msg.alert('This is the login page with specific id which matches criteria');
      }     
   }
});

So as in the above example we have given regex in the condition which clearly states what type of data should be allowed as URL parameter.

Sharing same URL across different device profiles

As Sencha touch provides device profile so the same application code can be used across multiple devices there may be possibilities that different profiles may have different functionality for the same URL.

To resolve this issue Sencha touch gives us freedom to write routing in the main controller and the called function to be written in the all the profile with their profile specific ones.

Ext.define('MyApp.controller.Main', {
   extend: 'Ext.app.Controller', config: {
      routes: {
         login: 'showLogin'
      }
   },
});
// For phone profile
Ext.define('MyApp.controller.phone.Main, {
   extend: 'MyApp.controller.Main, showLogin: function() {
      Ext.Msg.alert('This is the login page for mobile phone profile');
   }
});
// For tablet profile
Ext.define('MyApp.controller.tablet.Main, {
   extend: 'MyApp.controller.Main,showLogin: function() {
      Ext.Msg.alert('This is the login page for tablet profile');
   }
});

As example shows we have one main controller which has showLogin function and we have two different profiles(Phone/ Tablet). Both the profile has showLogin function with different code specific to the profile.

This way we can share same URL across multiple profile devices with their specific functionalities.

Sencha Touch - Upload & Download

Sencha Touch provides XHR2 configuration to work with Ajax and Ajax2 development.

XHR2 is xmlHttpRequest level 2, which used to request data from the server. For any web application, data resides at the server and once the page is loaded, the data should be accessed from the server with the help of Ajax requests.

XHR2 in Sencha Touch provides the progress bar feature, which shows the user the amount of data transferred for a particular request. XHR2 is newly added so we need to check if the browser supports it or not.

Following is the function to check whether the browser supports XHR2 −

if (Ext.feature.has.XHR2) {
   // Here we can write functionality to work if browser supports XHR2 
}  

We can even check if the progressive upload with XHR2 is supported by the browser or not.

if (Ext.feature.has.XHRUploadProgress) {
   // Here we can write functionality to work if browser supports progressive uploads
}

Various new XHR2 features are included in Sencha Touch.

Sr.No Features & Description
1

XHR2: true

This is used to enable and disable XHR2 functionality in the application.

2

Ext.field.File

New file field is added to give more cality about the type of field.

3

Ext.field.FileInput

This to provide FileInput.

4

Ext.progressIndicator

This is to provide exact percentage of data transferred in terms of progress bar.

5

xtype: fileinput

To create instance of fileInput class.

6

xtype: filefield

To create instance of file class.

7

responseType : value

This parameter allows various types of responses as text, document, blob etc.

Following are the examples to send simple ajax request with and without parameter and uploading files using ajax.

Simple Ajax request without parameters - Success

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.setup({
            requires: [ 'Ext.Panel', 'Ext.Button', 'Ext.form.Panel'], onReady: function() {
               var request = {
                  url: 'https://www.yoursite.com/sencha_touch/index.htm',
                  method: 'POST',
                  xhr2: true,
                  success: function(response) {
                     Ext.Msg.alert('Ajax call successful');
                  },
                  failure: function(response) {
                     Ext.Msg.alert('Ajax call failed');
                  }
               };
               Ext.Viewport.add({
                  xtype:"panel",
                  layout:"vbox",
                  fullscreen:true,
                  items: [
                     {
                        xtype:"button",
                        text: "Ajax",
                        ui: 'confirm',
                        handler: function(){
                           Ext.Ajax.request(request);
                        }
                     }
                  ]
               });
            }
         });
      </script>
   </head>
   <body>
   </body>
</html>

It will produce the following result −

The above example shows the success ajax call as the URL mentioned is correct. In this example, we are not passing any parameter, it’s just a simple ajax request which hits the URL mentioned.

If you are using the chrome browser in the developer tool, navigate to the network section, you can see the request which is being sent and the response which we get.

Simple Ajax request without parameters - Failure

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.setup({
            requires: [
               'Ext.Panel',
               'Ext.Button',
               'Ext.form.Panel'
            ],
            onReady: function() {
               var request = {
                  url: 'https://www.yoursite.com/sencha_touch/indexx.htm',
                  method: 'POST',
                  xhr2: true,
                  success: function(response) {
                     Ext.Msg.alert('Ajax call successful');
                  },
                  failure: function(response) {
                     Ext.Msg.alert('Ajax call failed');
                  }
               };
               Ext.Viewport.add({
                  xtype:"panel",
                  layout:"vbox",
                  fullscreen:true,
                  items: [
                     {
                        xtype:"button",
                        text: "Ajax",
                        ui: 'confirm',
                        handler: function(){
                           Ext.Ajax.request(request);
                        }
                     }
                  ]
               });
            }
         });
      </script>
   </head>
   <body>
   </body>
</html>

It will produce the following result −

In the above example, just to show how ajax failure works we have mentioned the wrong URL. Compare this and the previous example, you will find the difference.

Sending parameters in Ajax request

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.setup({
            requires: [
               'Ext.Panel',
               'Ext.Button',
               'Ext.form.Panel'
            ],

            onReady: function() {
               var formData = new FormData();
               formData.append("firstName", "Hi");
               formData.append("lastName", "Reader");

               // Request will be sent as part of the payload instead of standard post data
               var request = {
                  url: 'https://www.yoursite.com/sencha_touch/sencha_json.php',
                  method: 'POST',
                  xhr2: true,
                  data: formData,
                  success: function(response) {
                     var out = Ext.getCmp("output");
                     response = Ext.JSON.decode(response.responseText, true);
                     Ext.Msg.alert(response.message);
                  },
                  failure: function(response) {
                     var out = Ext.getCmp("output");
                     Ext.Msg.alert('Ajax failed!');
                  }
               };

               Ext.Viewport.add({
                  xtype:"panel",
                  layout:"vbox",
                  fullscreen:true,
                  items: [
                     {
                        xtype:"button",
                        text: "Ajax",
                        ui: 'confirm',
                        handler: function(){
                           Ext.Ajax.request(request);
                        }
                     }
                  ]
               });
            }
         });      
      </script>
   </head>
   <body>
   </body>
</html>

It will produce the following result −

In this example, we are passing parameters with the ajax using data property of ajax call.

Uploading files using Ajax

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <link href = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/resources/css/sencha-touch.css" rel = "stylesheet" />
      <script type = "text/javascript" src = "https://cdn.sencha.com/touch/sencha-touch-2.4.2/sencha-touch-all.js"></script>
      <script type = "text/javascript">
         Ext.setup({
            requires: [
               'Ext.Panel',
               'Ext.MessageBox',
               'Ext.Button',
               'Ext.ProgressIndicator',
               'Ext.form.Panel',
               'Ext.field.FileInput'
            ],

            onReady: function() {
               var progressIndicator = Ext.create("Ext.ProgressIndicator", {
                  loadingText: "Uploading: {percent}%"
               });

               var request = {
                  url: 'https://www.yoursite.com/sencha_touch/sencha_json.php',
                  method: 'POST',
                  xhr2: true,
                  progress:progressIndicator,
                  success: function(response) {
                     Ext.Msg.alert('File uploaded successfully.');
                  },
                  failure: function(response) {
                     Ext.Msg.alert('File upload failed.');
                  }
               };

               Ext.Viewport.add(progressIndicator);
               Ext.Viewport.add({
                  xtype:"panel",
                  layout:"vbox",
                  fullscreen:true,
                  items: [
                     {
                        xtype:"fileinput",
                        accept:"image/jpeg"
                     },
                     {
                        xtype:"button",
                        text: "Upload",
                        ui: 'confirm',
                        handler: function(){
                           var input = Ext.Viewport.down("fileinput").input;
                           var files = input.dom.files;
                           if (files.length) {
                              request.binaryData = files[0];
                              Ext.Ajax.request(request);
                           }else {
                              Ext.Msg.alert("Please Select a JPG");
                           }
                        }
                     }
                  ]
               });
            }
         });
      </script>
   </head>
   <body>
   </body>
</html>

It will produce the following result −

This example shows how to upload data using ajax call. In this example, we are using the progress bar indicator to show the progress while uploading the file.

Sencha Touch - View Components

Sencha Touch provides various UI components, which can be customized according to requirements.

Sr.N0. Component & Description
1 Carousel

This UI component is used to display Carousel.

2 List

This UI component is used to display lists.

3 Nested List

This UI component is used to display nested list.

4 Form

This UI component is used to display Forms.

5 Chart

This UI component is used to display different types of charts.

6 Floating Component

This UI component is used to display floating component.

7 Tab Panel

This UI component is used to display Tab panel view.

8 Navigation View

This UI component is used to display navigation view.

9 Action Menu

This UI component is used to display action menu bar.

10 Data View

This UI component is used to display data view.

11 Map

This UI component is used to display google map.

Sencha Touch - Packaging

Sencha Touch comes with native packaging features.

Following are the links for native packaging concepts of Sencha Touch.

Sr.No. Concept & Description Link
1 Native iOS provisioning
2 Native APIs

Sencha Touch - Best Practice

Basic JavaScript best practice

It is a good practice to keep all JavaScript-related code in a separate js (external JS) file, instead of writing it in the <script> tag under the head section or inline JavaScript in the document body.

Always perform a null check before the element is being used in further logic.

Always follow the naming convention, as it makes the code easy to understand by any other programmer.

To make the code easily understandable, it is always preferred to write comments for JS methods with clear logic behind what a function does.

Best practice specific to Sencha Touch

Use Sencha Touch recommended folder structure, which will be helpful during JS compression or minification.

It is highly recommended to use the listener (onclick/onblur, etc.) in the controller instead of writing it in the html page itself.

Do not create the store instance, when the store is being called from the view.

When we create an instance of a store, we should always destroy it, as it impacts the performance.

While using Sencha Touch, do not specify any other simple JavaScript file. Use all the functions from Ext classes (mentioned in controller or utils).

When the model mapping and the name are same, then do not specify mapping. Only name will solve the purpose.

Do not use unnecessary properties in view. Use only the property which is required and it value which is different from the default value.