RSS

Jquery code with wordpress jetpack

Şubat 26
1
2
3
4
5
6
7
8
<script type="text/javascript">
jQuery(document).ready(function($){
 
	$(".news-text").click(function(){
	  $(this).children(":first").toggle('slow');
	});
});
</script>

Aliasing the jQuery Namespace

When using another JavaScript library, we may wish to call $.noConflict() to avoid namespace difficulties. When this function is called, the $ shortcut is no longer available, forcing us to write jQuery each time we would normally write $. However, the handler passed to the .ready() method can take an argument, which is passed the global jQuery object. This means we can rename the object within the context of our .ready() handler without affecting other code:

1
2
3
jQuery(document).ready(function($) {
  // Code using $ as usual goes here.
});

Arama Terimleri:

 

Posted by on 26 Şubat 2013 in Bilgisayar, Programlama, Wordpress

Leave a comment