You've defined a function, but you're using it like a method on the jQuery object.
if you do this:
function f(param1, param2){
// code
}
you need to use it like this:
f(div, 4);
If you want to use it like you are, you need to do something like this:
$.fn.SetHeight = function(param1, param2){
// code
}
So you might want this:
function SetHeight(height){
var outer = this.outerHeight(true);
var current = this.height();
var margin = outer-current;
height = height-margin;
this.css("height",height);
return this; // to allow chaining
};
$.fn.SetHeight = SetHeight; // add as a jQuery method
Then you can use your code:
$("#Slider").SetHeight(h-260).removeClass("mobile");
Which you can use as you did in your example.
Notice that this
is already a jQuery object, so you don't need to wrap it like: $(this)
. And you should return this
at the end to support chaining - like calling .removeClass("mobile")
at the end.
See also: http://api.jquery.com/jQuery.fn.extend/