Scrolling crtbtn

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Thu Aug 29, 2013 2:50 pm
Reply with quote
Report this post
From what I've read:

1. This will only work if virtuemart is installed?

2. I tried implementing the code that someone in the forums posted but scrolling btn didn't work.

What is the solution? Wait for VirtueMart3?
User avatar
Gold Boarder

GK User
Thu Aug 29, 2013 4:02 pm
Reply with quote
Report this post
Hi,

The cart button was strictly connected with the VirtueMart cart. As VirtueMart is not available for Joomla! 3.x we have removed this feature. It will be added back when VirtueMart for Joomla! 3.x will be released.
User avatar
Administrator

GK User
Thu Aug 29, 2013 11:51 pm
Reply with quote
Report this post
Hi... using it for something else.

Is there a way to link to a page when one clicks on this scrolling crtbtn?
User avatar
Gold Boarder

GK User
Fri Aug 30, 2013 7:54 am
Reply with quote
Report this post
But the cart button is not available in the Joomla! 3.x StoreBox template.
User avatar
Administrator

GK User
Fri Aug 30, 2013 4:41 pm
Reply with quote
Report this post
To correct you:

1. The Cart Popup Window is not available.

2. The graphic of the round cart button is - and I would like to know how to create a link to a webpage if someone was to click on this.

3. thuto.us currently am using Joomla 2.5. If you click on the round button the module published to cart position comes up.

Am wondering as to how to do this for Joomla 3.0
User avatar
Gold Boarder

GK User
Sat Aug 31, 2013 12:07 pm
Reply with quote
Report this post
if you have the cart button on the page then you can redirect user after click using this code:

Code: Select all
jQuery(document).ready(function() {
    jQuery('#btnCart').click(function(e) {
        e.preventDefault();
        window.location.href = 'YOUR URL';
    });
});
User avatar
Administrator

GK User
Tue Sep 03, 2013 6:59 pm
Reply with quote
Report this post
Thank-you!

In which folder/ file do I insert code?
User avatar
Gold Boarder

GK User
Wed Sep 04, 2013 7:57 am
Reply with quote
Report this post
You can put it at the end of the js/gk.scripts.js file in the template.
User avatar
Administrator

GK User
Mon Nov 04, 2013 10:40 am
Reply with quote
Report this post
Thanks dziudek for the little js script... added it and used a "hidden" cart menuitem as url to link it to my hikashop cart in j3.x + storebox
(ps would love to see future support for hikashop)
User avatar
Fresh Boarder

GK User
Fri Aug 15, 2014 11:46 am
Reply with quote
Report this post
dziudek wrote:if you have the cart button on the page then you can redirect user after click using this code:

Code: Select all
jQuery(document).ready(function() {
    jQuery('#btnCart').click(function(e) {
        e.preventDefault();
        window.location.href = 'YOUR URL';
    });
});

hello Dziudek ;)
i use storebox 2.5 and i have change the cart by facebook logo and add the code up
but no result and ahve error see this error :

Not Found

The requested URL /gk_storebox/www.yahoo.fr was not found on this server.

i dont know why ? what is the problem ? and i need when any body click in this icon open new page not in same page of my website.
thank you to resolve this problem
User avatar
Senior Boarder

GK User
Sat Aug 16, 2014 7:25 pm
Reply with quote
Report this post
@mben26 - you have to specify an URL with "http://" at the beginning - in other case it works as a part of your page URL :)
User avatar
Administrator

GK User
Sun Aug 17, 2014 9:00 pm
Reply with quote
Report this post
hello dziudek
thank you foryour quick reply, i have add "http://" abd it work well
but the problem when click in this icon the website site open in same page of the mywebsite
i need if is possible when click in thsi icon open and show new onglet or new page
and also when click in this icon ebfore open and show the website the cart black one open and see before it
how cancle this one to hide it ?
User avatar
Senior Boarder

GK User
Mon Aug 18, 2014 8:40 am
Reply with quote
Report this post
Unfortunately there is no way to open the link in new tab using JS. Regarding the cart popup - did you removed the code which opens it after clicking the #btnCart element?
User avatar
Administrator

GK User
Mon Aug 18, 2014 3:45 pm
Reply with quote
Report this post
hello dziudek,
is not profetional to open social website to same page of our website ?
i have add only the code in the end of the JS, no change more or remved any code ?
i have find also this code but i dont know how to use it ? is possible to use it or not :
<a href="http://www.facebook.com/" onclick="window.open(this.href); return false;">facebook</a>
User avatar
Senior Boarder

GK User
Tue Aug 19, 2014 8:35 am
Reply with quote
Report this post
As far as I know the following code:

Code: Select all
window.open(this.href); return false;


won't work in all browsers but you can try if you want, in this case please replace the old code with:

Code: Select all
jQuery(document).ready(function() {
    jQuery('#btnCart').click(function(e) {
        e.preventDefault();
        window.open('YOUR_URL');
    });
});
User avatar
Administrator

GK User
Wed Aug 20, 2014 10:21 pm
Reply with quote
Report this post
hello,
i have add this code and is work well:
jQuery(document).ready(function() {
jQuery('#btnCart').click(function(e) {
e.preventDefault();
window.open('http://www.yahoo.fr');return false;
});
});
but the problem of cart popup open when click in thsi icon open also in same time with this page
how i can resolve it to hide it when click in this icon open only the page of facebook ?
thank you
User avatar
Senior Boarder

GK User
Thu Aug 21, 2014 7:16 am
Reply with quote
Report this post
Did you unpublished the module from a cart module position?
User avatar
Administrator

GK User
Thu Aug 21, 2014 2:15 pm
Reply with quote
Report this post
yes i have do this before if unpublished thsi module, the icone hode from all tempalte no icone can click it
and also i have unpublished the Module Assignment no page and is same result no icone is hide ?
if yo uahve others idea how to hide this cart black one chen click the icon is JS because i havn't tray in this and i dont knw where can revised it in JS ?
bets greetings
User avatar
Senior Boarder

GK User
Fri Aug 22, 2014 5:45 am
Reply with quote
Report this post
Please remove the following code from the js/gk.scripts.js file:

Code: Select all
if(document.id('gkPopupCart')) {
         var btn = document.id('btnCart');
         
         window.addEvent('scroll', function(e) {
            var scroll = window.getScroll().y;
            var max = document.id('gkMainWrap').getSize().y;
            var final = 0;
            if(scroll > 70) {
               if(scroll < max - 122) {
                  final = scroll - 50;
               } else {
                  final = max - 172;
               }
            } else {
               final = 20;
            }
            btn.setStyle('top', final + "px");
         });
         
         popup_cart = document.id('gkPopupCart');
         popup_cart.setStyle('display', 'block');
         popup_cart_h = popup_cart.getElement('.gkPopupWrap').getSize().y;
         popup_cart_fx = new Fx.Morph(popup_cart, {duration:200, transition: Fx.Transitions.Circ.easeInOut}).set({'opacity': 0, 'height': 0 });
         var wait_for_results = true;
         var wait = false;
         
         document.id('btnCart').addEvent('click', function(e) {
            new Event(e).stop();   
            
            if(!wait) {
               new Request.HTML({
                  url: $GK_URL + document.id('btnCart').get('data-url'),
                  onRequest: function() {
                     document.id('btnCart').addClass('loading');
                     wait = true;
                  },
                  onComplete: function() {
                     var timer = (function() {
                        if(!wait_for_results) {
                           popup_overlay.fade(0.45);
                           popup_cart_fx.start({'opacity':1, 'height': popup_cart_h});
                           opened_popup = 'cart';
                           wait_for_results = true;
                           wait = false;
                           clearInterval(timer);
                           document.id('btnCart').removeClass('loading');
                        }
                     }).periodical(200);
                  },
                  onSuccess: function(nodes, xml, text) {
                     document.id('gkAjaxCart').innerHTML = text;
                     popup_cart.setStyle('display', 'block');
                     popup_cart_h = popup_cart.getElement('.gkPopupWrap').getSize().y;
                     popup_cart_fx = new Fx.Morph(popup_cart, {duration:200, transition: Fx.Transitions.Circ.easeInOut}).set({'opacity': 0, 'height': 0 });
                     wait_for_results = false;
                     wait = false;
                  }
               }).send();
            }
         });
      }
User avatar
Administrator

GK User
Fri Aug 22, 2014 8:22 pm
Reply with quote
Report this post
dziudek wrote:Please remove the following code from the js/gk.scripts.js file:

Code: Select all
if(document.id('gkPopupCart')) {
         var btn = document.id('btnCart');
         
         window.addEvent('scroll', function(e) {
            var scroll = window.getScroll().y;
            var max = document.id('gkMainWrap').getSize().y;
            var final = 0;
            if(scroll > 70) {
               if(scroll < max - 122) {
                  final = scroll - 50;
               } else {
                  final = max - 172;
               }
            } else {
               final = 20;
            }
            btn.setStyle('top', final + "px");
         });
         
         popup_cart = document.id('gkPopupCart');
         popup_cart.setStyle('display', 'block');
         popup_cart_h = popup_cart.getElement('.gkPopupWrap').getSize().y;
         popup_cart_fx = new Fx.Morph(popup_cart, {duration:200, transition: Fx.Transitions.Circ.easeInOut}).set({'opacity': 0, 'height': 0 });
         var wait_for_results = true;
         var wait = false;
         
         document.id('btnCart').addEvent('click', function(e) {
            new Event(e).stop();   
            
            if(!wait) {
               new Request.HTML({
                  url: $GK_URL + document.id('btnCart').get('data-url'),
                  onRequest: function() {
                     document.id('btnCart').addClass('loading');
                     wait = true;
                  },
                  onComplete: function() {
                     var timer = (function() {
                        if(!wait_for_results) {
                           popup_overlay.fade(0.45);
                           popup_cart_fx.start({'opacity':1, 'height': popup_cart_h});
                           opened_popup = 'cart';
                           wait_for_results = true;
                           wait = false;
                           clearInterval(timer);
                           document.id('btnCart').removeClass('loading');
                        }
                     }).periodical(200);
                  },
                  onSuccess: function(nodes, xml, text) {
                     document.id('gkAjaxCart').innerHTML = text;
                     popup_cart.setStyle('display', 'block');
                     popup_cart_h = popup_cart.getElement('.gkPopupWrap').getSize().y;
                     popup_cart_fx = new Fx.Morph(popup_cart, {duration:200, transition: Fx.Transitions.Circ.easeInOut}).set({'opacity': 0, 'height': 0 });
                     wait_for_results = false;
                     wait = false;
                  }
               }).send();
            }
         });
      }


hello thank yo ufro this code now is ok the cart popup is not appear thsi time hiden :D
but i have others problem :( the Scrolling crtbtn is fixed in up not like before bounc and up and down when mouve the page up and down ?
is possible t orevised this Scrolling crtbtn icon and mouve also when mlouve the webapge or not ???
many tkx for your support
User avatar
Senior Boarder

GK User
Fri Aug 22, 2014 11:51 pm
Reply with quote
Report this post
Right, please recover the following code fragment:

Code: Select all
 window.addEvent('scroll', function(e) {
            var scroll = window.getScroll().y;
            var max = document.id('gkMainWrap').getSize().y;
            var final = 0;
            if(scroll > 70) {
               if(scroll < max - 122) {
                  final = scroll - 50;
               } else {
                  final = max - 172;
               }
            } else {
               final = 20;
            }
            btn.setStyle('top', final + "px");
         });
         
User avatar
Administrator

GK User
Sat Aug 23, 2014 9:08 am
Reply with quote
Report this post
hello tkx for your rersponse
i have add this but same result :(
this si what i have in JS tell me if is right or not maybe have mistake or do error for this btn:
Code: Select all
if(document.id('gkPopupLogin') || document.id('gkPopupCart')) {
      var popup_overlay = document.id('gkPopupOverlay');
      popup_overlay.setStyles({'display': 'block', 'opacity': '0'});
      popup_overlay.fade('out');

      var opened_popup = null;
      var popup_login = null;
      var popup_login_h = null;
      var popup_login_fx = null;
      var popup_cart = null;
      var popup_cart_h = null;
      var popup_cart_fx = null;
      
      if(document.id('gkPopupLogin') && document.id('btnLogin')) {
         popup_login = document.id('gkPopupLogin');
         popup_login.setStyle('display', 'block');
         popup_login_h = popup_login.getElement('.gkPopupWrap').getSize().y;
         popup_login_fx = new Fx.Morph(popup_login, {duration:200, transition: Fx.Transitions.Circ.easeInOut}).set({'opacity': 0, 'height': 0 });
         document.id('btnLogin').addEvent('click', function(e) {
            new Event(e).stop();
            popup_overlay.fade(0.45);
            popup_login_fx.start({'opacity':1, 'height': popup_login_h});
            opened_popup = 'login';
            
            (function() {
               if(document.id('modlgn-username')) {
                  document.id('modlgn-username').focus();
               }
            }).delay(600);
         });
      }
      window.addEvent('scroll', function(e) {
                var scroll = window.getScroll().y;
                var max = document.id('gkMainWrap').getSize().y;
                var final = 0;
                if(scroll > 70) {
                   if(scroll < max - 122) {
                      final = scroll - 50;
                   } else {
                      final = max - 172;
                   }
                } else {
                   final = 20;
                }
                btn.setStyle('top', final + "px");
             });      
      popup_overlay.addEvent('click', function() {
         if(opened_popup == 'login')   {
            popup_overlay.fade('out');
            popup_login_fx.start({
               'opacity' : 0,
               'height' : 0
            });
         }
         
         if(opened_popup == 'cart')   {
            popup_overlay.fade('out');
            popup_cart_fx.start({
               'opacity' : 0,
               'height' : 0
            });
         }   
      });
   }
});
User avatar
Senior Boarder

GK User
Sun Aug 24, 2014 11:16 pm
Reply with quote
Report this post
It seems that you have recovered the whole removed code when I have asked to restore only the fragment specified in my post.
User avatar
Administrator

GK User
Mon Aug 25, 2014 7:07 am
Reply with quote
Report this post
what's wrong in my code mr dziudek ? can you tell me the error and what's the line to remove
i have send to yu all what i have now in JS and is work well when click the icon but only this icon is fixed not scroll !!!
tkx
User avatar
Senior Boarder

GK User
Mon Aug 25, 2014 7:36 am
Reply with quote
Report this post
Are you sure that you have pasted the whole code from the gk.scripts.js file?
User avatar
Administrator

GK User
Mon Aug 25, 2014 7:43 am
Reply with quote
Report this post
hello this is the whol code of gk.scripts.js :
Code: Select all
//
var page_loaded = false;
//
window.addEvent('load', function() {
   //
   page_loaded = true;
   // smooth anchor scrolling
   new SmoothScroll();
   // style area
   if(document.id('gkStyleArea')){
      document.id('gkStyleArea').getElements('a').each(function(element,i){
         element.addEvent('click',function(e){
               e.stop();
            changeStyle(i+1);
         });
      });
   }
   // font-size switcher
   if(document.id('gkTools') && document.id('gkMainbody')) {
      var current_fs = 100;
      var content_fx = new Fx.Tween(document.id('gkMainbody'), { property: 'font-size', unit: '%', duration: 200 }).set(100);
      document.id('gkToolsInc').addEvent('click', function(e){
         e.stop();
         if(current_fs < 150) {
            content_fx.start(current_fs + 10);
            current_fs += 10;
         }
      });
      document.id('gkToolsReset').addEvent('click', function(e){
         e.stop();
         content_fx.start(100);
         current_fs = 100;
      });
      document.id('gkToolsDec').addEvent('click', function(e){
         e.stop();
         if(current_fs > 70) {
            content_fx.start(current_fs - 10);
            current_fs -= 10;
         }
      });
   }
   // K2 font-size switcher fix
   if(document.id('fontIncrease') && document.getElement('.itemIntroText')) {
      document.id('fontIncrease').addEvent('click', function() {
         document.getElement('.itemIntroText').set('class', 'itemIntroText largerFontSize');
      });
      
      document.id('fontDecrease').addEvent('click', function() {
         document.getElement('.itemIntroText').set('class', 'itemIntroText smallerFontSize');
      });
   }
   // change the login
   if(document.getElement('a[title="login"]')) {
      document.getElement('a[title="login"]').setProperty('id', 'btnLogin');
   }
   // login popup
   if(document.id('gkPopupLogin') || document.id('gkPopupCart')) {
      var popup_overlay = document.id('gkPopupOverlay');
      popup_overlay.setStyles({'display': 'block', 'opacity': '0'});
      popup_overlay.fade('out');

      var opened_popup = null;
      var popup_login = null;
      var popup_login_h = null;
      var popup_login_fx = null;
      var popup_cart = null;
      var popup_cart_h = null;
      var popup_cart_fx = null;
      
      if(document.id('gkPopupLogin') && document.id('btnLogin')) {
         popup_login = document.id('gkPopupLogin');
         popup_login.setStyle('display', 'block');
         popup_login_h = popup_login.getElement('.gkPopupWrap').getSize().y;
         popup_login_fx = new Fx.Morph(popup_login, {duration:200, transition: Fx.Transitions.Circ.easeInOut}).set({'opacity': 0, 'height': 0 });
         document.id('btnLogin').addEvent('click', function(e) {
            new Event(e).stop();
            popup_overlay.fade(0.45);
            popup_login_fx.start({'opacity':1, 'height': popup_login_h});
            opened_popup = 'login';
            
            (function() {
               if(document.id('modlgn-username')) {
                  document.id('modlgn-username').focus();
               }
            }).delay(600);
         });
      }
            
      popup_overlay.addEvent('click', function() {
         if(opened_popup == 'login')   {
            popup_overlay.fade('out');
            popup_login_fx.start({
               'opacity' : 0,
               'height' : 0
            });
         }
         
         if(opened_popup == 'cart')   {
            popup_overlay.fade('out');
            popup_cart_fx.start({
               'opacity' : 0,
               'height' : 0
            });
         }   
      });
   }
});

// function to set cookie
function setCookie(c_name, value, expire) {
   var exdate=new Date();
   exdate.setDate(exdate.getDate()+expire);
   document.cookie=c_name+ "=" +escape(value) + ((expire==null) ? "" : ";expires=" + exdate.toUTCString());
}
// Function to change styles
function changeStyle(style){
   var file1 = $GK_TMPL_URL+'/css/style'+style+'.css';
   var file2 = $GK_TMPL_URL+'/css/typography/typography.style'+style+'.css';
   var file3 = $GK_TMPL_URL+'/css/typography/typography.iconset.style'+style+'.css';
   new Asset.css(file1);
   new Asset.css(file2);
   new Asset.css(file3);
   Cookie.write('gk_storebox_j25_style', style, { duration:365, path: '/' });
}

/* VirtueMart addons */
window.addEvent('domready', function() {
   var tabs = document.id('product-tabs');
   // if tabs exists
   if(tabs) {
      // initialization
      tabs.getElement('li').addClass('active');
      var contents = document.id('product-tabs-content');
      contents.getChildren('div').setStyle('display', 'none');
      contents.getElement('div').addClass('active');
      // add events to the tabs
      tabs.getElements('li').each(function(tab, i) {
         tab.addEvent('click', function() {
            var toggle = tab.getProperty('data-toggle');
            contents.getChildren('div').removeClass('active');
            contents.getElement('.' + toggle).addClass('active');
            tabs.getElements('li').removeClass('active');
            tab.addClass('active');      
         });
      });
   }
   
   var products = document.getElements('.browse-view .product');
   var categories = document.getElements('.category-view .category');
   var f_products = document.getElements('.featured-view .product');
   var l_products = document.getElements('.latest-view .product');
   var t_products = document.getElements('.topten-view .product');
   var r_products = document.getElements('.recent-view .product');
   
   [products, categories, f_products, l_products, t_products, r_products].each(function(p) {
      if(p.length > 0) {
         p.each(function(item,i) {
            item.addEvents({
               "mouseenter": function() {
                  item.addClass('active');
               },
               "mouseleave": function() {
                  item.removeClass('active');
               }
            });
         });
      }
   });
   
   var productZoom = document.getElements('.productDetails .main-image');
   if(productZoom.length > 0) {
      productZoom.each(function(item,i) {
         var overlay = item.getElement('.product-overlay');
         var link = item.getElement('a');
         if(overlay) {
            overlay.inject(link, 'bottom');
         }
         item.addEvents({
            "mouseenter": function() {
               item.addClass('active');
            },
            "mouseleave": function() {
               item.removeClass('active');
            }
         });
      });
   }
});

window.addEvent('touchstart', function(e) {
   if(e.target.hasClass('modal') || e.target.hasClass('ask-a-question')) {
      window.location.href = e.target.getProperty('href');
   }
});

window.addEvent('load', function() {
    if(document.getElement('body').getProperty('data-mobile') === 'true') {
        setTimeout(function() {
            document.getElements('.modal').removeEvents();
            document.getElements('.ask-a-question').removeEvents();
        }, 2000);
    }
});

jQuery(document).ready(function() {
    jQuery('#btnCart').click(function(e) {
        e.preventDefault();
        window.open('http://www.facebook.fr');return false;
    });
});   


tell me what is wrong and what i removed from this one ?
User avatar
Senior Boarder

GK User
Mon Aug 25, 2014 7:57 am
Reply with quote
Report this post
Please change it to:

Code: Select all
//
var page_loaded = false;
//
window.addEvent('load', function() {
   //
   page_loaded = true;
   // smooth anchor scrolling
   new SmoothScroll();
   // style area
   if(document.id('gkStyleArea')){
      document.id('gkStyleArea').getElements('a').each(function(element,i){
         element.addEvent('click',function(e){
               e.stop();
            changeStyle(i+1);
         });
      });
   }
   // font-size switcher
   if(document.id('gkTools') && document.id('gkMainbody')) {
      var current_fs = 100;
      var content_fx = new Fx.Tween(document.id('gkMainbody'), { property: 'font-size', unit: '%', duration: 200 }).set(100);
      document.id('gkToolsInc').addEvent('click', function(e){
         e.stop();
         if(current_fs < 150) {
            content_fx.start(current_fs + 10);
            current_fs += 10;
         }
      });
      document.id('gkToolsReset').addEvent('click', function(e){
         e.stop();
         content_fx.start(100);
         current_fs = 100;
      });
      document.id('gkToolsDec').addEvent('click', function(e){
         e.stop();
         if(current_fs > 70) {
            content_fx.start(current_fs - 10);
            current_fs -= 10;
         }
      });
   }
   // K2 font-size switcher fix
   if(document.id('fontIncrease') && document.getElement('.itemIntroText')) {
      document.id('fontIncrease').addEvent('click', function() {
         document.getElement('.itemIntroText').set('class', 'itemIntroText largerFontSize');
      });
     
      document.id('fontDecrease').addEvent('click', function() {
         document.getElement('.itemIntroText').set('class', 'itemIntroText smallerFontSize');
      });
   }
   // change the login
   if(document.getElement('a[title="login"]')) {
      document.getElement('a[title="login"]').setProperty('id', 'btnLogin');
   }
   // cart
   if(document.id('btnCart')) {
      var btn = document.id('btnCart');   
         window.addEvent('scroll', function(e) {
            var scroll = window.getScroll().y;
            var max = document.id('gkMainWrap').getSize().y;
            var final = 0;
            if(scroll > 70) {
               if(scroll < max - 122) {
                  final = scroll - 50;
               } else {
                  final = max - 172;
               }
            } else {
               final = 20;
            }
            btn.setStyle('top', final + "px");
         });
   }
   // login popup
   if(document.id('gkPopupLogin')) {
      var popup_overlay = document.id('gkPopupOverlay');
      popup_overlay.setStyles({'display': 'block', 'opacity': '0'});
      popup_overlay.fade('out');

      var opened_popup = null;
      var popup_login = null;
      var popup_login_h = null;
      var popup_login_fx = null;
      var popup_cart = null;
      var popup_cart_h = null;
      var popup_cart_fx = null;
     
      if(document.id('gkPopupLogin') && document.id('btnLogin')) {
         popup_login = document.id('gkPopupLogin');
         popup_login.setStyle('display', 'block');
         popup_login_h = popup_login.getElement('.gkPopupWrap').getSize().y;
         popup_login_fx = new Fx.Morph(popup_login, {duration:200, transition: Fx.Transitions.Circ.easeInOut}).set({'opacity': 0, 'height': 0 });
         document.id('btnLogin').addEvent('click', function(e) {
            new Event(e).stop();
            popup_overlay.fade(0.45);
            popup_login_fx.start({'opacity':1, 'height': popup_login_h});
            opened_popup = 'login';
           
            (function() {
               if(document.id('modlgn-username')) {
                  document.id('modlgn-username').focus();
               }
            }).delay(600);
         });
      }
           
      popup_overlay.addEvent('click', function() {
         if(opened_popup == 'login')   {
            popup_overlay.fade('out');
            popup_login_fx.start({
               'opacity' : 0,
               'height' : 0
            });
         }
         
         if(opened_popup == 'cart')   {
            popup_overlay.fade('out');
            popup_cart_fx.start({
               'opacity' : 0,
               'height' : 0
            });
         }   
      });
   }
});

// function to set cookie
function setCookie(c_name, value, expire) {
   var exdate=new Date();
   exdate.setDate(exdate.getDate()+expire);
   document.cookie=c_name+ "=" +escape(value) + ((expire==null) ? "" : ";expires=" + exdate.toUTCString());
}
// Function to change styles
function changeStyle(style){
   var file1 = $GK_TMPL_URL+'/css/style'+style+'.css';
   var file2 = $GK_TMPL_URL+'/css/typography/typography.style'+style+'.css';
   var file3 = $GK_TMPL_URL+'/css/typography/typography.iconset.style'+style+'.css';
   new Asset.css(file1);
   new Asset.css(file2);
   new Asset.css(file3);
   Cookie.write('gk_storebox_j25_style', style, { duration:365, path: '/' });
}

/* VirtueMart addons */
window.addEvent('domready', function() {
   var tabs = document.id('product-tabs');
   // if tabs exists
   if(tabs) {
      // initialization
      tabs.getElement('li').addClass('active');
      var contents = document.id('product-tabs-content');
      contents.getChildren('div').setStyle('display', 'none');
      contents.getElement('div').addClass('active');
      // add events to the tabs
      tabs.getElements('li').each(function(tab, i) {
         tab.addEvent('click', function() {
            var toggle = tab.getProperty('data-toggle');
            contents.getChildren('div').removeClass('active');
            contents.getElement('.' + toggle).addClass('active');
            tabs.getElements('li').removeClass('active');
            tab.addClass('active');     
         });
      });
   }
   
   var products = document.getElements('.browse-view .product');
   var categories = document.getElements('.category-view .category');
   var f_products = document.getElements('.featured-view .product');
   var l_products = document.getElements('.latest-view .product');
   var t_products = document.getElements('.topten-view .product');
   var r_products = document.getElements('.recent-view .product');
   
   [products, categories, f_products, l_products, t_products, r_products].each(function(p) {
      if(p.length > 0) {
         p.each(function(item,i) {
            item.addEvents({
               "mouseenter": function() {
                  item.addClass('active');
               },
               "mouseleave": function() {
                  item.removeClass('active');
               }
            });
         });
      }
   });
   
   var productZoom = document.getElements('.productDetails .main-image');
   if(productZoom.length > 0) {
      productZoom.each(function(item,i) {
         var overlay = item.getElement('.product-overlay');
         var link = item.getElement('a');
         if(overlay) {
            overlay.inject(link, 'bottom');
         }
         item.addEvents({
            "mouseenter": function() {
               item.addClass('active');
            },
            "mouseleave": function() {
               item.removeClass('active');
            }
         });
      });
   }
});

window.addEvent('touchstart', function(e) {
   if(e.target.hasClass('modal') || e.target.hasClass('ask-a-question')) {
      window.location.href = e.target.getProperty('href');
   }
});

window.addEvent('load', function() {
    if(document.getElement('body').getProperty('data-mobile') === 'true') {
        setTimeout(function() {
            document.getElements('.modal').removeEvents();
            document.getElements('.ask-a-question').removeEvents();
        }, 2000);
    }
});

jQuery(document).ready(function() {
    jQuery('#btnCart').click(function(e) {
        e.preventDefault();
        window.open('http://www.facebook.fr');return false;
    });
});
User avatar
Administrator

GK User
Mon Aug 25, 2014 8:20 am
Reply with quote
Report this post
thank you very much my brother yo uare good one :) work now very welllllllllllllllllllll
very nice
User avatar
Senior Boarder


cron