Results 1 to 5 of 5

Thread: simple div scroll using jquery

  1. #1
    Join Date
    Jan 2007
    Location
    Chennai, Tamil Nadu, India
    Posts
    31
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default simple div scroll using jquery

    i have a div with fixed height.
    i use dwscroll.
    it has many include files.
    when i use jquery animatins this dwscroll is not working but without the animations it works.
    so i need a simple jquery script which will scroll up or dowm according to the up/down button i click.
    i thought there should an option in jquery for that besides scrollTo option.

  2. #2
    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

    Not sure what you mean by 'dwscroll'. Is this a script that has a demo page, or something that comes with Dreamweaver, or what?

    If it is a script with a demo page, please provide a link to the dwscroll demo page.

    Also - provide links to pages on your site that are using dwscroll, one where it works, one where it is conflicting with jQuery.
    - John
    ________________________

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

  3. #3
    Join Date
    Jan 2007
    Location
    Chennai, Tamil Nadu, India
    Posts
    31
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default i got it from jquery scrollTop option

    http://www.dyn-web.com/code/scroll/documentation.php

    Dw_scroll is a javascript snippet which has various functionality to scroll an element with showing the browsers default scroll bar. it has functionality like detecting mouse wheel ...

    when i used this the page will not scroll and that is the default action for all elements if there is content to scroll. i mean that when the focus is in an element which has overflowed content then using the mouse wheel will not scroll the window it will just scrolls that element... sorry, you already know this.

    but the most important point is that when you use flash products which does some animation in the site... it supresses the mouse wheel scroll and the focus is always to the flash object.... if you scroll anywhere on the page it wont scroll the window instead the flash will get the wheel events...
    so i used the following code... to override it... (basically i do not know much about object tags focus and wheel events especially flash... may be that is the way it would have been coded)...

    i dont want to manipulate dwscroll instead i was trying for a new script which will scroll the window irrespective of the current focus...

    then i used jquery scrollTop option which comes with the animate effect....
    and now it is working.

    the code is...


    Code:
    var nou=0;
    
    $('html,body').mousewheel(function(event, delta) {
    	
    	if (delta > 0)
    	{
    		nou = $('html, body').scrollTop()
    		nou-=50
    
    		$('html, body').animate({scrollTop: nou}, 0);
    	}
    	else if (delta < 0)
    	{
    		nou = $('html, body').scrollTop()
    		nou+=50
    		
    		$('html, body').animate({scrollTop: nou}, 0);
    	}				
    
    });
    i dont want the animation so i made the animation duration to zero and as espected it works like the normal window scroll...

    but... i hope the scroll is triggered twice... by the default scroll event and by this jquery scroller.... though that could be the case ain't much difference...


    if you have any other more robust or effective standard alternate then please you can consider dropping that here...

  4. #4
    Join Date
    Mar 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Jhbjk

    Thanks for that! how to hypnotize someone

  5. #5
    Join Date
    Jan 2007
    Location
    Chennai, Tamil Nadu, India
    Posts
    31
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default i wrote my own class for scrolling

    and then i wrote my own simple sleek baby scroller.
    http://vikku.info/codetrash/Scroll_D...ing_Javascript
    this is just for an instance... i still have to upgrade it.

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
  •