JQuery Plugins #1
نویسنده: مجتبی کاویانی
تاریخ: ۱۳۹۱/۱۲/۰۷ ۱۶:۲۵
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
jQuery.fn.myPlugin = function() {
//محتویات پلاگین را اینجا مینویسیم
};(function( $ ) {
$.fn.myPlugin = function() {
//محتویات پلاگین را اینجا مینویسیم
};
})( jQuery );(function($){
$.fn.underline= function() {
this.hover(function(){
$(this).css( { text-decoration : underline })
}, function(){
$(this).css( { text-decoration : none } )
});
};
})(jQuery);
$("p").underline();(function( $ ){
$.fn.maxHeight = function() {
var max = 0;
this.each(function() {
max = Math.max( max, $(this).height() );
});
return max;
};
})( jQuery );var tallest = $('div').maxHeight(); // بیشترین ارتفاع عنصر را برمی گرداند(function( $ ){
$.fn.lockDimensions = function( type ) {
return this.each(function() {
var $this = $(this);
if ( !type || type == 'width' ) {
$this.width( $this.width() );
}
if ( !type || type == 'height' ) {
$this.height( $this.height() );
}
});
};
})( jQuery );$('div').lockDimensions('width').css('color', 'red');(function( $ ){
$.fn.tooltip = function( options ) {
var settings = $.extend( {
'location' : 'top',
'background-color' : 'blue'
}, options);
return this.each(function() {
// Tooltip plugin code here
});
};
})( jQuery );$('div').tooltip({
'location' : 'left'
});$(this).css( "text-decoration" ,"none" )
$(this).css( { text-decoration : underline })فکر کنم منظور ایشون («اونطوری» که نوشته) وجود dash در نام متغیر بوده.