Do they belong to you? Claim these comments.
Ariel Flesler
Is this you? Claim Profile »
1 year ago
in jQuery tablesorter - sorting tables is easy on ProDevTips
I'm curious about the difference you mention when using dimensions.
The plugin dimensions, slightly improves jQuery's function 'offset()' which is used by 'position()', tough I didn't saw any difference for now (in the new demo). What I mentioned before, about the option 'offset' being $().height() / 2, should be -$().height()/2. Note the '-'. Might that be the difference ?. You could also play with the option 'margin'. Try setting it to true, maybe that fixes it.
Lastly, on the last release, I allowed some overloading, and you can replace:
$.scrollTo( '....', {speed:500}); for $.scrollTo( '....', 500 );
Well... hope that helps ;)
Cheers.
The plugin dimensions, slightly improves jQuery's function 'offset()' which is used by 'position()', tough I didn't saw any difference for now (in the new demo). What I mentioned before, about the option 'offset' being $().height() / 2, should be -$().height()/2. Note the '-'. Might that be the difference ?. You could also play with the option 'margin'. Try setting it to true, maybe that fixes it.
Lastly, on the last release, I allowed some overloading, and you can replace:
$.scrollTo( '....', {speed:500}); for $.scrollTo( '....', 500 );
Well... hope that helps ;)
Cheers.
1 year ago
in jQuery Chili plus Code Autoescape is good code highlighting in Wordpress on ProDevTips
In case you're interested, here's a shorter version of your JS.
function showMainPic(pic){
var inner_html = '<img src="'+galleryDir+pic+'">';
var $mainPic = $("#mainPic").html(inner_html);
$.scrollTo( $mainPic, {
speed:500,
offset: $mainPic.height() / 2
});
};
Note that for using the option offset, you need at least jQuery.ScrollTo 1.2.4.
Cheers.</img>
function showMainPic(pic){
var inner_html = '<img src="'+galleryDir+pic+'">';
var $mainPic = $("#mainPic").html(inner_html);
$.scrollTo( $mainPic, {
speed:500,
offset: $mainPic.height() / 2
});
};
Note that for using the option offset, you need at least jQuery.ScrollTo 1.2.4.
Cheers.</img>
1 year ago
in jQuery - making scrolling and toggling simple on ProDevTips
Oops.. I mean '.' + klass. Not '#' + klass.
1 year ago
in jQuery - making scrolling and toggling simple on ProDevTips
@dave
If you use hasClass, you must remove the dot leading the className. As for speed.. that is odd, because if you take a look at hasClass:
hasClass: function(expr) {
return this.is("." + expr);
},
It's doing, internally, the same as I did. I don't think it can be really faster. hasClass is useful when you have the className in a variable, so it saves you the '#' + klass .
If you use hasClass, you must remove the dot leading the className. As for speed.. that is odd, because if you take a look at hasClass:
hasClass: function(expr) {
return this.is("." + expr);
},
It's doing, internally, the same as I did. I don't think it can be really faster. hasClass is useful when you have the className in a variable, so it saves you the '#' + klass .
1 year ago
in jQuery - making scrolling and toggling simple on ProDevTips
Indeed.. since the... third release, more or less. The plugin stopped relying on dimensions.
If you are interested, that function could be shorter written like this:
function toggleViz(el_id){
var $el = $("#"+el_id).toggleClass("hidden_simple");
if ( !$el.is('.hidden_simple') )
$.scrollTo( $el, {speed:500});
};
I do admit the examples don't show all the possible uses of the plugin. But the source code has some more examples and explains each customizable option too.
Please let me know, if you think it's not clear enough, thanks.
If you are interested, that function could be shorter written like this:
function toggleViz(el_id){
var $el = $("#"+el_id).toggleClass("hidden_simple");
if ( !$el.is('.hidden_simple') )
$.scrollTo( $el, {speed:500});
};
I do admit the examples don't show all the possible uses of the plugin. But the source code has some more examples and explains each customizable option too.
Please let me know, if you think it's not clear enough, thanks.
1 year ago
in jQuery - making scrolling and toggling simple on ProDevTips
Hi, doesn't this work as expected ?
function toggleViz(el_id){
$("#"+el_id).toggleClass("hidden_simple");
if($("#"+el_id).attr("className") != "hidden_simple"){
// see the modification here V
$.scrollTo( "#"+el_id, {speed:500});
}
}
function toggleViz(el_id){
$("#"+el_id).toggleClass("hidden_simple");
if($("#"+el_id).attr("className") != "hidden_simple"){
// see the modification here V
$.scrollTo( "#"+el_id, {speed:500});
}
}