...

View Full Version : jQuery .support() implementation



WHITEB0X
03-02-2011, 12:44 AM
Hi Guys! I'm new to this forum and have a great question to kick things off
Can someone please take a look at the following block of code. It's a jQuery plugin that adds a hash as well as a class to the clicked link. I happen to be fading transparent PNG's and I need to EXCLUDE Internet Explorer from recognizing the fade effect as it produces a black "fuzz" when it fades. can someone teach me how to use something like this:


var FADE_TIME = 500; if(!($.support.opacity)) { FADE_TIME = 0}

$('element').fadeOut(FADE_TIME)


And Place it inside the plugin somewhere to do this? I need help quick!!


$(function() {

var newHash = "",
$mainContent = $("#main-content"),
$pageWrap = $("#page-wrap"),
baseHeight = 0,
$el;



$("nav#footer").delegate("a", "click", function() {
window.location.hash = $(this).attr("href");
return false;
});

$(window).bind('hashchange', function(){

newHash = window.location.hash.substring(1);

if (newHash) {
$mainContent
.find("#guts")
.fadeOut(200, function() {
$mainContent.show().load(newHash + " #guts", function() {
$mainContent.fadeIn(200, function() {
});
$("nav#footer a").removeClass("current");
$("nav#footer a[href="+newHash+"]").addClass("current");
});
});
};

});

$(window).trigger('hashchange');

});

VIPStephan
03-02-2011, 01:04 AM
You have to generally disable fadeIn() for IE, i. e. just invoke show() if opacity isn’t supported. Something like:


if($.support.opacity) {
$('element').fadeIn(500);
}
else {
$('element').show();
}


But I can’t tell you where to insert that in your code as I have no idea what it’s supposed to do.

WHITEB0X
03-02-2011, 01:09 AM
you can see here how I'm using the plugin
http://iamwhitebox.com/staging/arkitek



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum