-
-
Save jsbimra/cc19d14d0cf50f76692df5ea5dfc3c96 to your computer and use it in GitHub Desktop.
SKype SanGat Gurbani - Iframe Scroll
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="parent-container"> | |
<input type="text" id="txtGurbaniURL" value=" | |
http://sttm.co/s/3504" /> | |
<input type="button" id="btnLoadURL" value="Load Page" /> | |
<div style="clear:both"></div> | |
<iframe name="ssGurbaniIframe" id="ssGurbaniIframe" src="" width="468" height="300"></iframe> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
var shabadBaseUrL = "https://www.sikhitothemax.org/shabad", | |
paramId = "?id="; | |
$("#btnLoadURL").on("click", function() { | |
var gLink = $("#txtGurbaniURL").val(), | |
shabadId = getShabadId(gLink.split("/")), | |
shabadURL = shabadBaseUrL + paramId + (shabadId !== undefined ? shabadId : 1); | |
$("#ssGurbaniIframe").attr("src", shabadURL); | |
$("#ssGurbaniIframe").css({ | |
border: "1px solid red" | |
}); | |
$("#ssGurbaniIframe").contents().scrollTop(400); | |
}); | |
function getShabadId(a) { | |
var z, id; | |
if (a && a.length) { | |
a.forEach(function(i) { | |
z = parseInt(i); | |
if (z && typeof z === "number") { | |
id = z; | |
} | |
}); | |
return id; | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment