Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function objTest()
- {
- //Properties
- var self = this;
- this.envList = {};
- this.handlerList = {};
- var envirPath = 'images/environments/';
- this.set = function(param,handleData)
- {
- if ( param === 'envList' || param === 'handlerList' )
- {
- $.ajax({
- context : this,
- type: "POST",
- url: "debug_ambientes_ajax_v0_2_1.php",
- dataType : 'json',
- data: {
- list : param
- },
- success: function( data ){
- handleData(data);
- }
- });
- }
- else if ( param === 'environments' )
- {
- $.ajax({
- context : this,
- type: "POST",
- url: "debug_ambientes_ajax_v0_2_1.php",
- dataType : 'json',
- data: {
- list : param
- },
- success: function( data ){
- jQuery.each( data.images, function(key, val){
- $('#sideEnvirList').append($('<li><img src="' + envirPath + val.thumb + '" title="Img" alt="Img"/><span class="highResImg hidden">' + val.high + '</span></li>'));
- });
- }
- });
- }
- }; //end set
- this.set('envList', function(output) { this.envList = self = output; } );
- this.set('handlerList', function(output) { this.handlerList = self = output; });
- this.set('environments');
- //debug propouses only
- setTimeout(function() {
- //console.log( this.envList )
- }, 3000);
- setTimeout(function() {
- //console.log( this.handlerList )
- }, 3000);
- /*
- * bind mouse events to functions
- */
- $(function(){
- var intLeft = 0;
- var antecipation = 0;
- $('#confoGalHorSlider .handlers').bind({
- click : function(){
- if ( $(this).attr('id') === 'confoGalLeft' )
- {
- if ( self.curProdIndex > 1 )
- {
- //antecipate anim
- antecipation = intLeft - 25;
- $('#galleryProductRow').animate({
- left : antecipation
- }, 250 );
- intLeft = intLeft + self.eachProdBlockWidth;
- self.curProdIndex = self.curProdIndex - 1;
- $('#galleryProductRow').animate({
- left : intLeft
- });
- }
- }
- else if ( $(this).attr('id') === 'confoGalRight' )
- {
- if ( self.curProdIndex <= self.totalProducts - self.nrDisplayProds )
- {
- //antecipate anim
- antecipation = intLeft + 25;
- $('#galleryProductRow').animate({
- left : antecipation
- }, 250 );
- intLeft = intLeft - self.eachProdBlockWidth;
- self.curProdIndex = self.curProdIndex + 1;
- $('#galleryProductRow').animate({
- left : intLeft
- });
- }
- }
- }
- });
- $('.eachProduct').bind({
- mouseover: function(){
- $(this).animate({
- top : -25,
- height : '125px'
- },200);
- $(this).find('.eachProdBack').fadeIn();
- },
- mouseleave: function(){
- $(this).animate({
- top : 0,
- height: '100px'
- },200);
- $(this).find('.eachProdBack').fadeOut();
- }
- });
- var intTop = 0;
- antecipation = 0;
- $('.handlersVert').bind({
- click : function(){
- if ( $(this).attr('id') == 'confoGalVertTop' )
- {
- if ( self.slideCurProdIndex > 1 )
- {
- //antecipate anim
- antecipation = intTop - 25;
- $('#hiddenVertEnvir ul#sideEnvirList').animate({
- top : antecipation
- }, 250 );
- intTop = intTop + self.slideProdBlockHeight;
- self.slideCurProdIndex = self.slideCurProdIndex - 1;
- $('#hiddenVertEnvir ul#sideEnvirList').animate({
- top : intTop
- });
- }
- }
- else if ( $(this).attr('id') == 'confoGalVertBot' )
- {
- if ( self.slideCurProdIndex <= self.slideTotalProducts-self.slideCurProdIndex )
- {
- //antecipate anim
- antecipation = intTop + 25;
- $('#hiddenVertEnvir ul#sideEnvirList').animate({
- top : antecipation
- }, 250 );
- intTop = intTop - self.slideProdBlockHeight;
- self.slideCurProdIndex = self.slideCurProdIndex + 1;
- $('#hiddenVertEnvir ul#sideEnvirList').animate({
- top : intTop
- });
- }
- } //end if
- }
- });
- $('ul#sideEnvirList li').bind({
- click : function(){
- /*
- var slideTxt = $(this).text();
- $('#confoImgCont').text( 'Ambiente: ' + slideTxt );
- $('#confoGalHorSlider').animate({
- bottom : '-68px'
- });
- setTimeout(function() {
- $('#confoGalHorSlider').animate({
- bottom : '0px'
- });
- }, 500);
- */
- var highResImg = $(this).find('.highResImg').text();
- var img = new Image();
- //hidde horizontal slider
- $('#confoGalHorSlider').animate({
- bottom : '-68px'
- });
- $(img).load(function () {
- //remove current img
- $('#highResImg').remove();
- //hide img being loaded
- $(this).hide();
- $('#confoImgCont').removeClass('loading').append(this);
- $(this).fadeIn();
- //show horizontal slider
- $('#confoGalHorSlider').animate({
- bottom : '0px'
- });
- }).error(function () {
- // notify the user that the image could not be loaded
- }).attr('src', envirPath + highResImg).attr('id', 'highResImg').attr('title','title').attr('alt','alt');
- }
- });
- $('.eachProduct').bind({
- click : function(){
- $('#galProductDetails').fadeIn();
- }
- });
- $('.closeBtn').bind({
- click : function(){
- $('#galProductDetails').fadeOut();
- }
- });
- });
- } //end objTest
- //run test
- var runMe = new objTest();
Add Comment
Please, Sign In to add comment