').appendTo('body').fadeIn("slow"); $(".rslides").responsiveSlides({ auto: true, // Boolean: Animate automatically, true or false speed: 500, // Integer: Speed of the transition, in milliseconds timeout: 5000, // Integer: Time between slide transitions, in milliseconds pager: false, // Boolean: Show pager, true or false nav: true, // Boolean: Show navigation, true or false random: false, // Boolean: Randomize the order of the slides, true or false pause: true, // Boolean: Pause on hover, true or false pauseControls: true, // Boolean: Pause when hovering controls, true or false prevText: "Previous", // String: Text for the "previous" button nextText: "Next", // String: Text for the "next" button maxwidth: "", // Integer: Max-width of the slideshow, in pixels navContainer: "", // Selector: Where controls should be appended to, default is after the 'ul' manualControls: "", // Selector: Declare custom pager navigation namespace: "centered-btns", // String: Change the default namespace used before: function() { //if ((windowWidth) < $(".slideImages img").width()) { // imageWidthGlb = windowWidth; // $("#imageHolder").width(imageWidthGlb + 'px'); // console.log(windowWidth); //} else { // //$("#imageHolder").width($(".slideImages img").width()); // imageWidthGlb = image.width; // $("#imageHolder").width(imageWidthGlb + 'px'); // console.log(windowWidth); //} }, // Function: Before callback after: function () { } // Function: After callback }); imageObj.src = 'https://media.yellowpages-uae.com/wfile/photos/' + imageArray[0]; if (imageObj.complete) { console.log(); if ((windowWidth) < imageObj.width) { imageWidthGlb = windowWidth; } else { imageWidthGlb = imageObj.width; } $("#imageHolder").width(imageWidthGlb); $('#imageHolder').css('marginLeft', ((window.innerWidth - imageWidthGlb) / 2).toString() + 'px'); } else { // or bind onload handler for image imageObj.onload = function () { if ((windowWidth) < imageObj.width) { imageWidthGlb = windowWidth; } else { imageWidthGlb = imageObj.width; } $("#imageHolder").width(imageWidthGlb); $('#imageHolder').css('marginLeft', ((window.innerWidth - imageWidthGlb) / 2).toString() + 'px'); }; } } $('#close-btn-img').live('click', function () { $('#overlay').remove(); $('#imageHolder').remove(); }); $(window).resize(function () { if (imageObj.complete) { console.log(); if ((windowWidth) < imageObj.width) { imageWidthGlb = windowWidth; } else { imageWidthGlb = imageObj.width; } $("#imageHolder").width(imageWidthGlb); $('#imageHolder').css('marginLeft', ((window.innerWidth - imageWidthGlb) / 2).toString() + 'px'); } else { // or bind onload handler for image imageObj.onload = function () { if ((windowWidth) < imageObj.width) { imageWidthGlb = windowWidth; } else { imageWidthGlb = imageObj.width; } $("#imageHolder").width(imageWidthGlb); $('#imageHolder').css('marginLeft', ((window.innerWidth - imageWidthGlb) / 2).toString() + 'px'); }; } }); $(".showBrandsBtn").click(function (e) { var code = $(this).attr("data-db"); var thisElement = this; try { $.ajax({ type: "POST", url: "/services/webservices.asmx/GetBrandsList", cache: false, contentType: "application/json; charset=utf-8", data: JSON.stringify({ 'code': code }), dataType: "json", contentType: "application/json; charset=utf-8", success: function (data, status) { if (data != null && data.d != null) { var responseData = JSON.parse(data.d); if (responseData.html != null) { thisElement.parentElement.innerHTML = responseData.html; } } }, error: function () { } }); } catch (err) { console.log(err.message); } });