Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33

Thread: jQuery plugin not working in Firefox?!

  1. #1
    Join Date
    Nov 2009
    Posts
    43
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default jQuery plugin not working in Firefox?!

    Hi!

    I'm using a jQuery plugin called DragScroll so I can drag and scroll just like in google maps.

    This works fine in Safari and Opera, but it's not working in Firefox....

    You can find the site I'm working on here: bit.ly/297LCa

    If you check both Firefox and Safari you will see the problem: I can't drag in Firefox.......

    There is also another very similar plugin called ScrollDrag, but I have the same problem with this plugin too! Not working in Firefox..

    Does anyone know why this is happening? Maybe I've done something wrong in my html document?

    Could really need some help here!

    cheers,

    pooeky

  2. #2
    Join Date
    Nov 2009
    Posts
    43
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default

    Think I found out what the problem is!

    This is how my js code looked:

    <script type="text/javascript">
    $(window).load(function(){
    $('body').dragscroll();
    });

    When I now tried

    <script type="text/javascript">
    $(window).load(function(){
    $('#work').dragscroll();
    });

    </script>

    Looks like you can't use body in firefox? So how can I get the whole page to scroll and not just the div where my image is?

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'd try:

    Code:
    <script type="text/javascript">
    $(function(){
    	$(document.body).dragscroll();
    });
    </script>
    But, it may not be that you cannot use the body element, rather that the body element is not considered suitable in Firefox.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. The Following User Says Thank You to jscheuer1 For This Useful Post:

    pookeyblow (11-19-2009)

  5. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That won't work, but this will:

    Code:
     <script type="text/javascript">
    jQuery(function($){
    	$(document.documentElement).imagefit().dragscroll();
    });
     </script>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. The Following User Says Thank You to jscheuer1 For This Useful Post:

    pookeyblow (11-19-2009)

  7. #5
    Join Date
    Nov 2009
    Posts
    43
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default

    wow that was amazing!!

    but now it's not working in safari!

    almost there! maybe you know why it's not working in safari too? looks like the image disappears sometimes..!

  8. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I don't believe imagefit ever worked in Safari, and that Safari requires document.body. So you could do:

    Code:
     <script type="text/javascript">
    jQuery(function($){
    	if(/(Google)|(Apple)/.test(navigator.vendor)){
    		$(document.body).dragscroll();
    	}else{
    		$(document.documentElement).imagefit().dragscroll();
    	}
    });
     </script>
    Google Chrome would have the same problem as Safari. I'm not sure what the problem with imagefit is in those browsers. When I have some time, I will look into it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. The Following User Says Thank You to jscheuer1 For This Useful Post:

    pookeyblow (11-19-2009)

  10. #7
    Join Date
    Nov 2009
    Posts
    43
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Smile

    Thanks!

    I just tried out different things and got it to work by doing this:

    Code:
    		 <script type="text/javascript">
    $(window).load(function(){
    	if(/(Google)|(Apple)/.test(navigator.vendor)){
    		$(document.body).imagefit().dragscroll();
    	}else{
    		$(document.documentElement).imagefit().dragscroll();
    	}
    });
     </script>
    Strange eh?!

    Is it ok to do it like this?

    Link to the site: http://bit.ly/297LCa

  11. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    For what you are doing, this should work out:

    Code:
     <script type="text/javascript">
    jQuery(function($){
    	if(/(Google)|(Apple)/.test(navigator.vendor)){
    		$(document.body).dragscroll();
    		$('#work img').css('width', '100%');
    	}else{
    		$(document.documentElement).imagefit().dragscroll();
    	}
    });
     </script>
    You may even want to:

    Code:
     <script type="text/javascript">
    jQuery(function($){
    	if(/(Google)|(Apple)/.test(navigator.vendor)){
    		$(document.body).dragscroll();
    		$('#work img').css('width', '100%');
    	}else{
    		$(document.documentElement).dragscroll();
    		$('#work').imagefit();
    	}
    });
     </script>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  12. The Following User Says Thank You to jscheuer1 For This Useful Post:

    pookeyblow (11-19-2009)

  13. #9
    Join Date
    Nov 2009
    Posts
    43
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default

    Thanks! First one works!! but couldn't get imagefit to work in the second one when using Firefox or Opera..

    Thanks again for all the help!! It's highly appreciated!

  14. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I see what you mean, at least when the page isn't cached in Opera and Firefox. But I think using:

    Code:
    $(document.documentElement).imagefit().dragscroll();
    will cause problems with your two other images in some IE browsers. To prevent that, you may add this style to your style section:

    Code:
        	#infobox img, #topcontrol img {
        	 width: 48px!important;
        	}
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  15. The Following User Says Thank You to jscheuer1 For This Useful Post:

    pookeyblow (11-20-2009)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •