SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    More than one target in localScroll?

    Code:
    jQuery(function( $ ){
    	$.localScroll.defaults.axis = 'x';
    	// Scroll initially if there's a hash (#something) in the url 
    	$.localScroll.hash({
    		target: '#slider_content', // Could be a selector or a jQuery object too.
    		queue:true,
    		duration:1000
    	});
    	
    	/**
    	 * NOTE: I use $.localScroll instead of $('#navigation').localScroll() so I
    	 * also affect the >> and << links. I want every link in the page to scroll.
    	 */
    	$.localScroll({
    		target: '#slider_content', // could be a selector or a jQuery object too.
    		queue:true,
    		duration:500,
    		hash:true,
    		onBefore:function( e, anchor, $target ){
    			// The 'this' is the settings object, can be modified
    		},
    		onAfter:function( anchor, settings ){
    			// The 'this' contains the scrolled element (#content)
    		}
    	});
    });
    I'm trying to target more than one DIV -#slider_content- so that I may have the sliding effect more than once on the same page, I'm cranky and cannot think properly. Can someone help me?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,678
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Aries Mars View Post
    I'm trying to target more than one DIV -#slider_content- so that I may have the sliding effect more than once on the same page
    It is not allowed to have more than one element with the same unique identifier. It simply goes against everything that unique means.

    Can you use a class name instead?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm, it's not working. I know we can't use the same 'id' but the switching it to a class obj seem to break the plug-in. This is the effect I'm trying to use. I don't mind a quick and dirty trick, just as long as it works. Any thoughts?

    I appreciate it.

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,678
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Aries Mars View Post
    Hmmm, it's not working.
    It would be appreciated if you showed us what you are doing that's not working.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was able to figure out what I wasn't doing. I had to watch which element I was selecting and I keeping scripts separate instead of plunking everything on one page.


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
  •