www.webdeveloper.com
Results 1 to 3 of 3

Thread: Jquery Image Scroll Effect

  1. #1
    Join Date
    Apr 2013
    Posts
    8

    Jquery Image Scroll Effect

    Quick question does any one know any ideas how i would go about creating this effect where the images slide over the top of each.. Just need some pointers to start me off havent really got a clue where to start..

    http://denicler.eu/en/lookbooks/1

    manged to stack my images using postion abosolute and z index but cant get my images to scroll over each other.. :s any suggestions guys

    $(document).ready( function() {
    $(window).scroll( function() {
    if ($(window).scrollTop() > $('#lookbook img').offset().top)
    $('#lookbook img').addClass('fixed');
    else
    $('#lookbook img').removeClass('fixed');
    } );

    } );

  2. #2
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,709
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    
    .sswrapper {
      position:absolute;left:100px;top:100px;width:620px;height:306px;border:solid red 1px;background-Color:#FFFFCC;
    }
    
    .slideshow {
      position:absolute;left:20px;top:20px;width:350px;height:260px;border:solid red 1px;background-Color:#FFFFCC;
    }
    
    
    .slider {
      position:absolute;left:400px;top:80px;width:200px;height:140px;border:solid red 1px;background-Color:#FFFFCC;
    }
    
    .item {
      position:relative;left:10px;top:0px;width:180px;height:20px;border:solid red 1px;margin-Top:10px;background-Color:#FFCC66;cursor:pointer;
      opacity: .5;filter: alpha(opacity=50);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
    }
    
    .active {
      opacity:1;filter:alpha(opacity=100);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
    }
    
    
    #up {
     position:absolute;z-Index:2;left:500px;top:10px;cursor:pointer;
    }
    
    #down {
     position:absolute;z-Index:2;left:500px;top:285px;cursor:pointer;
    }
    /*]]>*/
    </style></head>
    
    <body>
    
     <div id="w" class="sswrapper" >
    
      <div id="ss" class="slideshow" >
       <img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt5.jpg" alt="img" width="350" />
       <img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" alt="img" width="350" />
       <img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt7.jpg" alt="img" width="350" />
       <img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt8.jpg" alt="img" width="350" />
      </div>
    
      <div id="tst" class="slider" >
        <div class="item" >Item 1</div>
        <div class="item" >Item 2</div>
        <div class="item" >Item 3</div>
        <div class="item" >Item 4</div>
      </div>
    
      <img id="up" src="http://www.vicsjavascripts.org.uk/StdImages/up[1].gif" alt="next" />
      <img id="down" src="http://www.vicsjavascripts.org.uk/StdImages/down[1].gif" alt="back" />
    
     </div>
    
    
    <script type="text/javascript">
    /*<![CDATA[*/
    // Slider Slide Show. (16-May-2013)  DRAFT
    // by Vic Phillips - http://www.vicsjavascripts.org.uk/
    
    var zxcSlider={
    
     GoTo:function(id,nu){
      var o=this['zxc'+id];
      if (o&&o.ary[nu]&&nu!=o.cnt){
       o.ud=nu>o.cnt?1:-1;
       this.rotate(o,1,nu);
      }
     },
    
     Next:function(id,ud){
      var o=this['zxc'+id],ud=typeof(ud)=='number'&&ud<0?-1:1;
      if (o){
       o.ud=ud;
       this.rotate(o,ud);
      }
     },
    
     Auto:function(id,ms){
      var o=this['zxc'+id],oop=this;
      if (o){
       o.to=setTimeout(function(){ oop.rotate(o,o.ud,true); },ms||200);
      }
     },
    
     Pause:function(id){
      var o=this['zxc'+id];
      if (o){
       clearTimeout(o.to);
       o.auto=false;
      }
     },
    
     init:function(o){
      var id=o.SlideShowID,m=o.Mode,ms=o.Speed,hold=o.AutoHold,srt=o.AutoStart,ud=o.Direction,acls=o.ActiveClass,ae=o.AddEvents,lks=document.getElementById(o.LinksID),ss=document.getElementById(id);
      if (ss){
       ss.style.overflow='hidden';
       var sss=ss?ss.childNodes:[],lks=lks?lks.childNodes:[],m=typeof(m)=='string'&&m.charAt(0).toUpperCase()=='H'?['left','top','offsetWidth']:['top','left','offsetHeight'],ms=typeof(ms)=='number'&&ms>20?ms:1000,ary=[],cnt=0,e,sz,z0=0,z1=0,z2=0;
       for (;z0<sss.length;z0++){
        if (sss[z0].nodeType==1){
         sss[z0].style.position='absolute';
         sss[z0].style.width='100%';
         sss[z0].style.height='100%';
         sz=sss[z0][m[2]];
         sss[z0].style[m[0]]=(ary.length!=0?-sz:0)+'px';
         sss[z0].style[m[1]]='0px';
         ary.push([sss[z0],m[0]]);
        }
       }
       for (;z1<lks.length;z1++){
        if (lks[z1].nodeType==1&&ary[cnt]){
         e=lks[z1].className;
         lks[z1].className=cnt!=0?e:e+' '+acls;
         ary[cnt][2]=[lks[z1],e,e+' '+acls];
         this.addevt(lks[z1],'mouseup','GoTo',id,cnt);
         cnt++;
        }
       }
       this['zxc'+id]=o={
        id:id,
        ary:ary,
        sz:sz,
        cnt:0,
        ms:ms,
        hold:typeof(hold)=='number'&&hold>0?hold:ms*4,
        ud:typeof(ud)=='number'&&ud<0?-1:1,
        run:false
       }
       if (ae instanceof Array){
        for (;z2<ae.length;z2++){
         obj=document.getElementById(ae[z2][0]);
         e=ae[z2][1];
         if (obj&&this[ae[z2][2]]&&(e=='mouseover'||e=='mouseout'||e=='mouseup'||e=='mousedown'||e=='click')){
          this.addevt(obj,e,ae[z2][2],id,ae[z2][3]);
         }
        }
       }
       o.lgth=o.ary.length-1;
       typeof(srt)=='number'&&srt>=0?this.Auto(id,srt):null;
      }
     },
    
     rotate:function(o,ud,auto){
      var cnt=o.cnt,lst=o.ary[cnt];
      clearTimeout(o.to);
      o.auto=auto===true;
      lst[0].style.zIndex='0';
      lst[2]?lst[2][0].className=lst[2][1]:null;
      cnt+=o.ud;
      o.ary[auto]?cnt=auto:null;
      cnt=cnt<0?o.lgth:cnt>o.lgth?0:cnt;
      o.ary[cnt][0].style.zIndex='1';
      this.animate(o,o.ary[cnt],o.sz*(o.ud>0?-1:1),0,new Date(),o.ms,lst);
      o.cnt=cnt;
     },
    
     animate:function(o,a,f,t,srt,mS,lst){
      clearTimeout(a[3]);
      var oop=this,ms=new Date()-srt,n=(t-f)/mS*ms+f;
      if (isFinite(n)){
       a[0].style[a[1]]=n+'px';
      }
      if (ms<mS){
       a[3]=setTimeout(function(){ oop.animate(o,a,f,t,srt,mS,lst); },10);
      }
      else {
       a[0].style[a[1]]=t+'px';
       lst[0].style[a[1]]=o.sz+'px';
       a=o.ary[o.cnt];
       t==0&&a[2]?a[2][0].className=a[2][2]:null;
       o.auto?this.Auto(o.id,o.hold):null;
      }
     },
    
     addevt:function(o,t,f,p,p1){
      var oop=this;
      if (o.addEventListener){
       o.addEventListener(t,function(e){ return oop[f](p,p1);}, false);
      }
      else if (o.attachEvent){
       o.attachEvent('on'+t,function(e){ return oop[f](p,p1); });
      }
     }
    
    
    }
    
    zxcSlider.init({
     SlideShowID:'ss',     // the unique ID name of the slide show wrapper DIV.               (string)
     LinksID:'tst',        // the unique ID name of the goto links wrapper DIV.               (string)
     Mode:'V',             //(optional) the slider mode, 'Vertical' or 'Horizontal'.          (string, default = 'Vertical')
     Speed:1000,           //(optional) the slider/fade speed in milli seconds.               (number, default = 1000)
     AutoHold:2000,        //(optional) the auto rotate 'hold' delay in milli seconds.        (number, default = Speed*4)
     AutoStart:2000,       //(optional) the auto rotate 'start' delay in milli seconds.       (number, default = no auto start)
     Direction:1,          //(optional) the rotate ditection, 1 = anti-clock, -1 = clockwise. (number, default = 1000)
     ActiveClass:'active', //(optional) the class modifier of the active slider item.         (string, default = no class modifier)
     AddEvents:[           //(optional) the event call to add to control the script.          (string, default = in line event calls)
      // field 0 = the unique ID name of the element.
      // field 1 = the event type.
      // field 2 = the script function.
      // field 3 = the parameter to pass to the function.
      ['up','mouseup','Next',1],
      ['down','mouseup','Next',-1],
      ['w','mouseover','Pause'],
      ['w','mouseout','Auto']
     ]
    });
    /*]]>*/
    </script>
    </body>
    
    </html>
    Vic

    God loves you and will never love you less.

    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. #3
    Join Date
    Apr 2013
    Posts
    8
    Thanks for the reply, but this not what i was looking for sorry!! i didnt want to put a slider in there i wanted the effect to happen with the scroll bar... thanks any way

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.33930 seconds
  • Memory Usage 2,884KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (3)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (73):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates