Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
jQuery browser detection
Old 08-18-2009, 04:16 PM jQuery browser detection
pealo86's Avatar
Super Spam Talker

Posts: 850
Name: Matt Pealing
Location: England, north west
Trades: 0
I'm having css issues in Safari 3, and need to use jQuery to disable the styles for that particular browser.

I'm having a nightmare finding out how to do it! I hear the browser detection in jQuery is deprecated?

Is there any way for me to detect Safari 3 and below?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
pealo86 is online now
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
 
Register now for full access!
Old 08-18-2009, 04:23 PM Re: jQuery browser detection
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
It's deprecated but still present in the code. $.browser.safari should return true or false if Safari is present. That is as much support as jQuery offers. I do encourage you to not use browser detection, however, especially not to solve CSS problems.

Usually all that is needed is to simplify your CSS in order to obtain compatible results with Safari. It's interpretation is pretty standard, after all.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 08-18-2009, 04:49 PM Re: jQuery browser detection
pealo86's Avatar
Super Spam Talker

Posts: 850
Name: Matt Pealing
Location: England, north west
Trades: 0
Thanks, I can't seem to target a specific version though.

I did actually try for hours to fix the CSS problem but with no luck! It doesn't seem like an average CSS problem though, see here:

http://www.freshbeat.co.uk/concept/m...raphy.biz/dev/

In Safari 3, see how the image in the nav loads up wrong, but then when you hover over the link, it corrects itself.

I have a feeling it's something in the lavaLamp code. I even took the generated HTML and pasted it into a static page, and it loaded up fine?? Surely the problem must lie within the lavaLamp code?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
pealo86 is online now
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Old 08-18-2009, 05:20 PM Re: jQuery browser detection
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Don't have Safari 3 installed on this computer (I make due with Chrome and Safari 4), so hard for me to look at it.

Try blurring then focusing the .back class to see if that fixes it in Safari. If that doesn't work, toggling its positioning for a second when the document is ready, from relative then back to absolute again, might work. Stupid tricks will sometimes fix bad behavior like this.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 08-18-2009, 05:53 PM Re: jQuery browser detection
pealo86's Avatar
Super Spam Talker

Posts: 850
Name: Matt Pealing
Location: England, north west
Trades: 0
Thanks, I've tried it by adding this to my code but nothing happened, Im not sure if I did it right?

Code:
            jQuery(document).ready(function() {
                jQuery(".lavaLamp .back").focus()
            })
I even tried

Code:
jQuery(document).ready(function() {
                jQuery(".lavaLamp a").each.focus()
            })
but once again, no results!
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
pealo86 is online now
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Old 08-18-2009, 06:11 PM Re: jQuery browser detection
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Since focus is a singular event it must be on only one element at a time. It is also a native client-side JavaScript method, so it could be used like this:
Code:
jQuery(".lavaLamp a").each(function() {
     this.focus();
     this.blur();
});
I'm not saying this will work, I'm just speculating. I think you should be focusing on the .back class actually, since it actually holds background image. Be sure to do this after the lavaLamp plugin is actually activated, or it will be pointless.

Another idea is to place the lavaLamp activation code into a $(window).load(function(){}) event instead of the $(document).ready(function(){}) event, so that the browser will attempt to load all images before running the code.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 08-18-2009, 06:19 PM Re: jQuery browser detection
pealo86's Avatar
Super Spam Talker

Posts: 850
Name: Matt Pealing
Location: England, north west
Trades: 0
Just tried the $(window).load(function(){}) event and it worked! YYYEEEEESSSSS!!!

Thanks a million, you have no idea how much I've been ripping my hair out over the last few days because of that!
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
pealo86 is online now
Reply With Quote
View Public Profile Visit pealo86's homepage!
 
Old 08-18-2009, 07:03 PM Re: jQuery browser detection
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
You're welcome. I gave it my best guess... Glad you got it working.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to jQuery browser detection
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.27592 seconds with 12 queries