caleres-zoom
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -0,1 +1,34 @@ | ||
var modalTemplate = require('../templates/modal'); | ||
require('./modernizr-csstransforms') | ||
function supports3d() { | ||
// borrowed from modernizr | ||
var div = document.createElement('div'), | ||
ret = false, | ||
properties = ['perspectiveProperty', 'WebkitPerspective']; | ||
for (var i = properties.length - 1; i >= 0; i--){ | ||
ret = ret ? ret : div.style[properties[i]] != undefined; | ||
}; | ||
// webkit has 3d transforms disabled for chrome, though | ||
// it works fine in safari on leopard and snow leopard | ||
// as a result, it 'recognizes' the syntax and throws a false positive | ||
// thus we must do a more thorough check: | ||
if (ret){ | ||
var st = document.createElement('style'); | ||
// webkit allows this media query to succeed only if the feature is enabled. | ||
// "@media (transform-3d),(-o-transform-3d),(-moz-transform-3d),(-ms-transform-3d),(-webkit-transform-3d),(modernizr){#modernizr{height:3px}}" | ||
st.textContent = '@media (-webkit-transform-3d){#test3d{height:3px}}'; | ||
document.getElementsByTagName('head')[0].appendChild(st); | ||
div.id = 'test3d'; | ||
document.body.appendChild(div); | ||
ret = div.offsetHeight === 3; | ||
st.parentNode.removeChild(st); | ||
div.parentNode.removeChild(div); | ||
} | ||
return ret; | ||
} | ||
(function($){ | ||
@@ -31,3 +64,3 @@ $.dZoom = function(el, options){ | ||
if ($('html').hasClass('touch')) { | ||
$.load_script('/Content/mobile/dist/scripts/vendor/hammer.js', function(){ | ||
$.load_script('/Content/scripts/vendor/hammer.min.js', function(){ | ||
// set this element for later | ||
@@ -68,2 +101,3 @@ base.hammertimeone = new Hammer.Manager(base.$el.get(0), { touchAction: "pan-y" }); | ||
m.find('#prod-view-nav li').click(function(){ | ||
console.log('clicked'); | ||
base.options.view = $(this).index(); | ||
@@ -74,12 +108,13 @@ base.jumpToView(m.find('#zoom-images-container')); | ||
/* CLONE AND PLACE SIZES AND ADD TO CART -- */ | ||
var $selectSize = $('.step2 .input-select').first().clone(), | ||
$addToCart = $('.step2 .addToCart, .step2 .js-virtual-cart-btn').first().clone(), | ||
var $selectSize = $('.chooseBox [id$="ddlSizeAndWidth"]').first().clone(), | ||
$addToCart = $('.chooseBox .btn_Add2Cart, .step2 .js-virtual-cart-btn').first().clone(), | ||
$cartActionsLocation = m.find('#zoom-footer .right-footer'); | ||
/* SET PROXY AND INITIALIZE VALUE --- */ | ||
$selectSize.find('select').attr({'id':$selectSize.find('select').attr('id') + '_clone','name':$selectSize.find('select').attr('name') + '_clone'}); | ||
$selectSize.data('$proxy', $('.step2 .input-select select')).find('select').val( $('.step2 .input-select select').val() ); | ||
$addToCart.data('$proxy', $('.step2 .addToCart, .step2 .js-virtual-cart-btn').first()); | ||
$selectSize.attr({'id':$selectSize.attr('id') + '_clone','name':$selectSize.attr('name') + '_clone'}); | ||
$selectSize.data('$proxy', $('.chooseBox [id$="ddlSizeAndWidth"]')).val( $('.step2 .input-select select').val() ); | ||
$addToCart.data('$proxy', $('.chooseBox .btn_Add2Cart, .step2 .js-virtual-cart-btn').first()); | ||
$selectSize.find('select').change(function(){ | ||
$selectSize.change(function(){ | ||
$selectSize.data('$proxy').val( $(this).val() ).trigger('change'); | ||
@@ -117,3 +152,3 @@ }); | ||
if (wrapHeight < newWrapHeight) { | ||
if ($('html').hasClass('csstransforms')) { | ||
if (Modernizr.csstransforms) { | ||
$( base.options.replaceSel ).data('origHeight', wrapHeight).css({'height' : newWrapHeight + 'px'}); | ||
@@ -154,3 +189,3 @@ } else { | ||
if ($('html').hasClass('touch')) { | ||
$.load_script('/Content/mobile/dist/scripts/vendor/hammer.js', function(){ | ||
$.load_script('/Content/scripts/vendor/hammer.min.js', function(){ | ||
// set this element for later | ||
@@ -171,3 +206,3 @@ base.$zoomEl = m.find('#zoom-images-container'); | ||
if ($( base.options.replaceSel ).data('origHeight')) { | ||
if ($('html').hasClass('csstransforms')) { | ||
if (Modernizr.csstransforms) { | ||
$( base.options.replaceSel ).css({'height' : $( base.options.replaceSel ).data('origHeight') + 'px'}); | ||
@@ -185,3 +220,2 @@ } else { | ||
base.onPan = function(ev) { | ||
console.log(base.translate.x); | ||
base.$zoomEl.removeClass( base.options.nextClass ).removeClass( base.options.resetClass ); | ||
@@ -194,3 +228,2 @@ base.panning.x = base.translate.x + Number(ev.deltaX); | ||
base.onPanEnd = function(ev) { | ||
console.log('panend'); | ||
base.width = base.$zoomEl.find( base.options.blockSel ).first().outerWidth(); | ||
@@ -203,2 +236,3 @@ if (Math.abs(ev.velocityX) > .5 && Math.abs(ev.deltaX) > 90) { | ||
} | ||
console.log('JUMP: ' + base.jump); | ||
if (base.jump > 0 || Math.abs(base.jump) >= base.total) { | ||
@@ -212,3 +246,2 @@ base.$zoomEl.addClass( base.options.resetClass ); | ||
// /* SET NAV --- */ | ||
console.log( base.jump ); | ||
base.options.view = Math.abs( base.jump ); | ||
@@ -235,3 +268,2 @@ base.jumpToView(base.$zoomEl, true); | ||
base.placeZoom = function(){ | ||
console.log('placing zoom...'); | ||
/* TRACK EVENT --- */ | ||
@@ -242,3 +274,3 @@ _satellite.track('zoom_opened'); | ||
$('body').toggleClass('zooming'); | ||
$( base.options.replaceSel ).before('<div id="zoom-container" />'); | ||
if ($('#zoom-container').length == 0) $( base.options.replaceSel ).before('<div id="zoom-container" />'); | ||
var data = { | ||
@@ -270,4 +302,3 @@ feature: { | ||
console.log( data ); | ||
$.render($('#details-zoom').html(), data, '#zoom-container', false, base.zoomBind); | ||
$.render(modalTemplate, data, '#zoom-container', false, base.zoomBind); | ||
}; | ||
@@ -300,3 +331,3 @@ | ||
base.jumpToView = function($containerEl, animate) { | ||
if (typeof(animate) == 'undefined') animate = true; | ||
animate = animate || true; | ||
@@ -314,3 +345,3 @@ if (base.options.view < 0) base.options.view = 0; | ||
if ($('html').hasClass('csstransforms')) { | ||
if (Modernizr.csstransforms) { | ||
if (animate) $containerEl.addClass('jumping'); | ||
@@ -317,0 +348,0 @@ else $containerEl.removeClass('jumping'); |
@@ -92,2 +92,5 @@ /* HOW TO ---------------------------------------- | ||
render: function(template, data, destination, placementType, bindCallback) { | ||
/* YES, WE DO ACCEPT ARRAY TEMPLATES --- */ | ||
if (typeof template !== 'string') template = template.join(''); | ||
/* REMOVE SPACES FROM VARIABLES IN TEMPLATE --- */ | ||
@@ -97,5 +100,5 @@ template = template.replace(/{{\s+/g, '{{').replace(/\s+}}/g, '}}'); | ||
/* CONVERT UNDEFINED TO BOOLEAN --- */ | ||
if (typeof destination == 'undefined') destination = false; | ||
if (typeof placementType == 'undefined') placementType = false; | ||
if (typeof bindCallback == 'undefined') bindCallback = false; | ||
destination = destination || false; | ||
placementType = placementType || false; | ||
bindCallback = bindCallback || false; | ||
@@ -200,5 +203,2 @@ /* ERROR RESPONSE FOR UNDEFINED DATA PROPERTIES --- */ | ||
} else { | ||
/* YES, WE DO ACCEPT ARRAY TEMPLATES --- */ | ||
if (typeof template !== 'string') template = template.join(''); | ||
/* WORK THROUGH THE EACH SCENARIO FIRST --- */ | ||
@@ -205,0 +205,0 @@ if (matchifyEachRE.test(template)) { |
var $_render = require('./jquery-render'); | ||
var $_zoom = require('./jquery-dZoom'); | ||
var $_zoom = require('./jquery-dZoom'); | ||
var $_load_script = require('./jquery-load'); | ||
if ('ontouchstart' in window) $('html').addClass('touch'); |
{ | ||
"name": "caleres-zoom", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A zoom package for the Caleres web team.", | ||
@@ -13,4 +13,10 @@ "main": "index.js", | ||
], | ||
"author": "Ehren Coker", | ||
"license": "ISC" | ||
"author": { | ||
"name": "Ehren Coker" | ||
}, | ||
"license": "ISC", | ||
"readme": "ERROR: No README data found!", | ||
"_id": "caleres-zoom@0.0.3", | ||
"_shasum": "9a87b485e35ee04c3ad2747bac10b4b69f4e8d75", | ||
"_from": "caleres-zoom@0.0.3" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
52336
10
876
0