Tuesday, November 27, 2012

Resolve Conflicts jQuery

jQuery as a JavaScript framework derivative the most used are also prone to conflicts between a good script script with script on the same framework or with scripts with different framework. Actually the official jQuery website already provide a very easy solution to resolve the conflict between this script but it does not hurt Blogger Tune-Up back to help discuss, especially for those who find jQuery functions that are not working well.

jQuery basic commands are always preceded by the symbol "$" (without the quotes) or do we know this symbol with the name "Dollar". This is the identity of jQuery commands, so if the blogger friends find a script that always starts with a "$" then this is the jQuery script. And it is obligatory that the jQuery script must be accompanied by the jQuery framework as the base system. JQuery framework must first be called (load) to script declarations that we make are able to walk normally. Fortunately for the webdesigner who like the jQuery framework because the framework is fully supported by the Google. Google provides a good resource to use jQuery and to be developed, so that we as bloggers who prefer to use it is not difficult to install the jQuery framework on our blog. To install the jQuery framework on our blog, Google has provided some easy ways, including:

1. jQuery Google API
 This method is the easiest and safest way to handle script error risk level of the smallest

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'/>

2. jQuery Google API Load
This method is a technique I describe as the most secure, fast and light to call the jQuery framework

<script src='http://www.google.com/jsapi'/>
<script>
google.load("jquery", "1.3.2");
</script>

3. jQuery Google API Autoload
 This method has a handle script error rate is very high but it is the fastest technique of calling jQuery framework

<script src='http://www.google.com/jsapi?autoload={"modules" : [{"name" : "jquery","version" : "1.3.2"}]}' type='text/javascript'/>

As already explained above that the jQuery script always starts with the symbol "$" symbol is to be considered because it is a symbol declaration jQuery functions. So this is also a solution to the conflict jQuery scripts. How to resolve the conflict? Example below is an often Blogger Tune-Up used to solve jQuery conflict. 

Consider the example of a script that has not been written declaration to overcome conflicts below:

$(document).ready(function(){
$('#pg').jphotogrid({
baseCSS: {
width: '160px',
height: '117px',
padding: '0px'
},

selectedCSS: {
top: 'auto',
left: '5px',
width: '470px',
height: '350px',
padding: '5px'
}

});
});

The script above is already running well but the possibility of clashes is very easy going. Consider the example of a script that has been written declaration to overcome conflicts below:

var $jnoc = jQuery.noConflict();
$jnoc (document).ready(function(){
$jnoc ('#pg').jphotogrid({
baseCSS: {
width: '160px',
height: '117px',
padding: '0px'
},

selectedCSS: {
top: 'auto',
left: '5px',
width: '470px',
height: '350px',
padding: '5px'
}

});
});

Compare the example script above, we find that the difference is actually very simple.

var $ jnoc = jQuery.noConflict (); is a script to declare the jQuery.noConflict function that serves to resolve conflicts JavaScript.

$ jnoc the next script is a script to replace basic function symbol "$" so if we consider the fact all of the symbol "$" is replaced by a script jQuery.noConflict only $ jnoc represented by the script that has been previously declared on line 1.

$ jnoc can be replaced with any word as you want, provided in accordance with the word previously declared as a representative of jQuery.noConflict script at line 1.


Posted by: Admin
Easy Learn Computer, Updated at: 1:12 PM

10 komentar:

DialUs India said...
This comment has been removed by a blog administrator.
festplatte-kaputt.info said...

thanks for the news

Marry Andorson said...
This comment has been removed by a blog administrator.
iloveanimals said...

i want exchange textlink.
Mysite : driverlap.blogspot.com
email:jloveshincute@gmail.com.
tks admin.

GlobalTechz said...

Thanks for the information

Mirza Ahmed Ali said...
This comment has been removed by a blog administrator.
Eslam said...

Thanks for this news :)

jhon said...

Your contents are more then help for me.
free web directory Canada

Sinelogix said...
This comment has been removed by a blog administrator.
Paul Brighton said...

Thanks for this great post.

Post a Comment

If you want to comment, We appreciate.
Please do not include a link, use the Link Exchange Facility