Posts

Showing posts from August, 2012

Solution to use href and onclick together in anchor tag.

Scenario : We have to track number of times link click by user (Using Adobe siteCatalyst). We tried added onClick function with href attribute. But when we use href it ignores onClick. So we have use below alternative. Link : < a href="javascript:TrackSiteCatalystAndRedirect('event1','bannerimage','00000','SOME_PROD');"> Script : < script type="text/javascript" language="javascript"> function ImageTracking(event, link, productId, productName) { //Tracking code } function TrackSiteCatalystAndRedirect(event, link, productId, productName) { ImageTracking(event, link, productId, productName); window.location = "/product-results.aspx"; }  
Hack to make asynchronous JQuery Slider/Motion -> Synchronized. Scenario : JQuery slider contains 8+ images. 4 images are visible on screen at a time and user can click next and previous links to move slider. But if user clicks next/previous button multiple times. Slider's UI breaks. We have to stop user from clicking next/previous second time if slider is moving or in progress. var isProcessing = 0; var waitMiliSec = 1100; var objInterval;   function moveToPrevious() { if (isProcessing == 0) { setIsProcessing(1, 0); objInterval = setInterval(function () { setIsProcessing(0, 1) }, waitMiliSec); //Slider's asynchronyzed slide code //Any JQuery asynchronyzed code }     } function moveToNext() { if (isProcessing == 0) { setIsProcessing(1, 0); objInterval = setInterval(function () { setIsProcessing(0, 1) }, waitMiliSec); //Slider's asynchronyzed slide code //Any JQuery asynchronyzed code } }     fun...