javascript - Is there something wrong with my JS if statement? -


Working with JS, Junkies, Bootstrap 3 Rather than being individually triggered instead of making different models, I wrote a script based on the embedded content model, and then fill the model with embedded content.

Model markup:

  & lt; Div class = "modal fade" id = "ideasmodal" tabindex = "- 1" role = "dialog" aria-labelledby = "MyModalLabel" aria-hidden = "true" & gt; & Lt; Div class = "modal-dialog modal-lg" & gt; & Lt; Div class = "modal-content" & gt; & Lt; Div class = "model headers" & gt; & Lt; Button type = "button" class = "off" data-discarded = "model" & gt; & Lt; Duration aria-hidden = "true" & gt; & Amp; times; & Lt; / Span & gt; & Lt; span class = "sr-only" & gt; Close & lt; / Span & gt; & Lt; / Button & gt; & Lt; H4 class = "modal-title" id = "myModalLabel" & gt; & Lt; / H4 & gt; & Lt; / Div & gt; & Lt; Div class = "modal-body" id = "library-content" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

Triggers:

  & lt; A data-frame = "http: //path.to.url" data-content = "embed" class = "btn btn-primary montagram" roll = "button" & gt; Learn more & lt; / A & gt; & Lt; a data-frame = "http: //path/to/image.png" data-content = "image" class = "BTN BTN-Primary model stripper" role = "button" & gt; Learn more & lt; / A & gt; $ {Document} .ready (function () {$ (".modaltrigger") .click (function () {var dataContent = ModalBody = document on this.getAttribute ("data-content"); if (dataContent = "embedded") {var modalClass = 'embed sensitive embed sensitive -16 by9'; modalContent = this.getAttribute ("data frame"); EmbedContainer = document.createElement ("div"); embedContainer.setAttribute ("class", modalClass); modalBody.setAttribute ("src", modalContent) modalBody.setAttribute ("class", "embed") on the createElement ("IFRAME"); ModalBody.setAttribute ("frameborder", "0"); document.getElementById ("library-content") appendChild (embedContainer); embedContainer.appendChild (modalBody); $ ('#'.) Mod ModalBody = document.createElement ("IMG"); modalBody.setAttribute ("src"); var (datacontent = "image") {var modalContent = this.getAttribute ("data frame"); ", ModalContent); modalBody.setAttribute (" class "," img-responsive "); Document.getElementById ("libr ary-content") appendChild (modalBody). $ ('# Ideasmodal') Model ('Show'). }}); $ (Close ".") (Function () {document.getElementById ("library-content"). InnerHTML = "";}); });   

What's happening on the live site, when I click on the link with the data-content = "image", the site is still making IRM versus. Without embedding the image directly (ELSE) of my statement, this is not a great deal, I do not want to be limited to the ratios defined by the bootstrap's sensitive embed class - my images are always in the 4: 3 or 16: 9 ratio Are not fit.

I am very new to JS, so if I am missing something very obvious then I am sorry. I have run it with the console / debugger and I have not found any error throwing other than the string (which, by searching, I can ignore it on this site so far as it is a flash issue).

Both of your statements contain only 1

  if (data Content == "embed") {// logic} and if (data content == "image") {// logic}    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -