Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Image lazy load issue

Image lazy load issue

Scheduled Pinned Locked Moved JavaScript
helpquestionhtmldesign
1 Posts 1 Posters 8 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tidelgl
    wrote on last edited by
    #1

    hi,please help me out,how can I get "args" for resizableImg method??? /** * * @class MyImgConfWin * @extends Ext.Window */ MyImgConfWin = Ext.extend(Ext.Window, { constructor : function() { //... //....... var fbutton = new Ext.ux.form.FileUploadField({ //..... listeners : { 'fileselected' : function(fb, v) { //... //can not get args because of the lazy load var args = this.setEditorStyle(v); this.resizableImg(args); }, scope:this } });// end fbutton MyImgConfWin.superclass.constructor.call(this, { //..... });// end call },// end constructor /** * init resizable * @param {} args */ resizableImg : function(args) { var x = args[0], y = args[1], maxH = args[2], maxW = args[3]; //do other stuff },// end resizableImg /** * init editor sytle * * @param {} src * @return {} */ setEditorStyle:function(src){ var imgEl = Ext.get('MyImgConfWin-imgEdiId'), imgDom = imgEl.dom, resizableEl = Ext.get('MyImgConfWin-imgResizableId'), resizableDom = resizableEl.dom; var imgHelper = new Image(), imgHelperH = null, imgHelperW = null; var args = []; imgHelper.onload = function() { imgHelperH = imgHelper.height; imgHelperW = imgHelper.width; var h = (356 > imgHelperH) ? imgHelperH : 356; var w = (415 > imgHelperW) ? imgHelperW : 415; h = (40 > h) ? 40 : h; w = (40 > w) ? 40 : w; imgDom.style.height = h; imgDom.style.width = w; resizableDom.style.height = (80 < h) ? (h / 2) : 40; resizableDom.style.width = (80 < w) ? (w / 2) : 40; imgDom.style.marginTop = (356 > imgHelperH) ? ((356 - imgHelperH) / 2) : 1; imgDom.style.marginLeft = (415 > imgHelperW) ? ((415 - imgHelperW) / 2) : 1; imgDom.src = src; var x = imgEl.getX(), y = imgEl.getY(); x = (h > 100) ? (x + 10) : x; y = (w > 100) ? (y + 10) : y; var maxH = (356 > imgHelperH) ? (h-5) : 300; var maxW = (415 > imgHelperW) ? (w-5) : 380; args.push(x); args.push(y); args.push(maxH); args.push(maxW); } // after onload for fix lazy load imgHelper.src = src;

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups