Post by laurenrodriguez on Oct 15, 2012 23:14:03 GMT -6
Branding is the most important part of any sharepoint project. If you are planning to deliver branding in your release, you have to make sure your developer team is proactive to deliver quality branding from early stage of the project. In most of the branding project, jQuery and javascript becomes must-have part. Here we will discuss practices that can be fullowed to ensure quality deliverables.
Practice
1. Manage script files
From the very starting stage of your project, split your all javascript code in three files.
1.jQuery.min.js - This will contain jQuery reference and should be reference first in order.
2.jQuery.plugins.js - This should contain all custom plugins we used in it.
3.ProjectName.js - This hsould contain all your custom code written to get your project pages work properly??
2.Choosing plugins for your project
1.Download plugin bundle to your local computer
2.Generally plugin will contain sample html files, jQuery and plugin script files.
First thing to check is, jQuery version you are using in your project and the one which is used in plugin
3.If they are different, replace their jQuery.min.js with the one we are using
4.Properly test the sample provided in plugin in all browsers you are planning to support
5.Once browser and version compability matches paste plugin's min.js at end of jQuery.plugins.js file.
6.Implement plugin specific mark up wherever applicable
7.Always use projectName.js to initialize plugin.
8.Repeat above process when you choose to add any jQuery plugin
3.Resulving CONFLICTS!
.Another challenging part is jQuery ready not working or custom plugin you are using is disturbing your site's css. Here are thoughts on the same
1.Aways use _spBodyOnLoadFunctionNames.Push("yourFunctionName") to init your scripts in page load.
2.Always use only necessary css from what plugin css has proviced and prefix class or ID in css as application. For example if a generic class .clear is used and you are calling plugin using $('#news') you should replace that with #news .clear. Do this for all css you include for the class
Final thoughts
Here we pointed out some of the best practices. Like this post? You like to add/correct something? please provide your feedback on the same.
To get more info about sharepoint Development visit - www.binaryrepublik.com/
Practice
1. Manage script files
From the very starting stage of your project, split your all javascript code in three files.
1.jQuery.min.js - This will contain jQuery reference and should be reference first in order.
2.jQuery.plugins.js - This should contain all custom plugins we used in it.
3.ProjectName.js - This hsould contain all your custom code written to get your project pages work properly??
2.Choosing plugins for your project
1.Download plugin bundle to your local computer
2.Generally plugin will contain sample html files, jQuery and plugin script files.
First thing to check is, jQuery version you are using in your project and the one which is used in plugin
3.If they are different, replace their jQuery.min.js with the one we are using
4.Properly test the sample provided in plugin in all browsers you are planning to support
5.Once browser and version compability matches paste plugin's min.js at end of jQuery.plugins.js file.
6.Implement plugin specific mark up wherever applicable
7.Always use projectName.js to initialize plugin.
8.Repeat above process when you choose to add any jQuery plugin
3.Resulving CONFLICTS!
.Another challenging part is jQuery ready not working or custom plugin you are using is disturbing your site's css. Here are thoughts on the same
1.Aways use _spBodyOnLoadFunctionNames.Push("yourFunctionName") to init your scripts in page load.
2.Always use only necessary css from what plugin css has proviced and prefix class or ID in css as application. For example if a generic class .clear is used and you are calling plugin using $('#news') you should replace that with #news .clear. Do this for all css you include for the class
Final thoughts
Here we pointed out some of the best practices. Like this post? You like to add/correct something? please provide your feedback on the same.
To get more info about sharepoint Development visit - www.binaryrepublik.com/