Scrolling Cart Script for a particular catalog item

Cupcake
Mega Guru

Hi am trying this script for my catalog item that I got from the user community and I keep getting an error. Can someone take a look please?

Here is the link where I got the code from: Scrolling Cart for Service Request - Oslova Networks

find_real_file.png

Thank you,

Karen

18 REPLIES 18

Hi David,


        If you don't mind 1 final time of reviewing the code that i have. It still is not scrolling when the page scrolls. I have NO Syntax errors (Awesome Sauce !). Just not sure why the "Order Now" button is not scrolling still. I did change the code to catch(e), and catch(e1).



var adder;  


var cartContent;  


         


      function onLoad()  


      {  


              try  


              {  


                      adder = gel('adder');  


                      adder.style.position = "relative";  


              }  


              catch(e)  


              {  


                      adder = '';  


              }  


               


              try  


              {  


                      cartContent = gel('sc_cart_contents');  


                      cartContent.style.position = "relative";  


              }  


              catch(e1)  


              {  


                      cartContent = '';  


              }  


               


              window.onscroll = function()  


              {  


                      try  


                      {  


                              var y = 12;  


                                 


                              if (typeof window.pageYOffset != 'undefined')  


                                      y = window.pageYOffset;  


                              else if (typeof document.documentElement.scrollTop != 'undefined' && document.documentElement.scrollTop > 0)  


                                      y = document.documentElement.scrollTop;  


                              else if (typeof document.body.scrollTop != 'undefined')  


                                      y = document.body.scrollTop;  


                                         


                              if (y > 60)  


                              {  


                                      if (adder != '')  


                                              adder.style.top = y - 60 + 'px';  


                                 


                                      if (cartContent != '')  


                                              cartContent.style.top = y - 60 + 'px';  


                              }  


                              else  


                              {  


                                      if (adder != '')  


                                              adder.style.top = 0 + 'px';  


                                         


                                      if (cartContent != '')  


                                              cartContent.style.top = 0 + 'px';  


                              }  


                      }  


                      catch(e)  


                      {  


                              if (adder != '')  


                                      adder.style.top = 0;  


                                 


                              if (cartContent != '')  


                                      cartContent.style.top = 0;  


                      }  


              };  


      }  


HI Karen,



I'm not also sure that for Eureka it won't run or not. But please do the following   things again as I say now (saying from the very beginning).


1. Please use the same code as I given above. Removing the function onLoad{}.


2. If it is not saving, Please comment the line cartContent = gel('sc_cart_contents') (under try)and save it. Again remove the comment and save it.



I hope this helps.Please mark correct/helpful based on impact


Amlan Pal, your code has errors and is improperly formatted.   Please look over your code first before posting.


Amlan,


The cart doesnt scroll in an iframe but it does scroll 'in the tool' is there a remedy to scroll in the iframe/cms view?